Re: [Ssh-sftp-perl-users] Determining sftp failure?
Brought to you by:
dbrobins
From: Mark F. <mar...@ea...> - 2004-02-01 22:40:53
|
I've decided to use this to determine if errors occured: ==================================== my @warnings; $SIG{'__WARN__'} = sub { $warnings[$#warnings + 1] = $_[0]; }; eval {$pwd = $sftp->do_realpath(".");}; $SIG{'__WARN__'} = 'DEFAULT'; if ($#warnings > -1 or (!defined($pwd) or $pwd eq '') ) { # treat it as an error, display each row of @array } ==================================== That might be a bad example. It seems like all the "do_" methods reliably return something indicating a bad execution. Where I have difficulty is with "get" or "put". I can't tell how to detect a failure without capturing warnings and checking them. If anyone knows a better way, I'd like to know about it. I was hoping for a method like Net::FTP's "object->message" or a positive or negative return from get/put. Thanks! Mark ----- Original Message ----- From: "Mark Fuller" <mar...@ea...> To: <ssh...@li...> Sent: Friday, January 30, 2004 3:08 PM Subject: [Ssh-sftp-perl-users] Determining sftp failure? > How can I determine if a ->put() (or other operation) failed? It seems like > sftp issues a warn but doesn't set a return code. I think a put returns a > "0" on success and "" on failures. "ls" returns the number of lines listed. > A "0" could mean an error? > > Is there a way to get access to the error messages sftp writes to the > terminal? > > Thanks, > Mark > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |