in reply to Re^2: Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works
in thread Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works

There is one issue that i noticed today. If i use the following code, it dies after printing error message. Obviously, the stdout will not be printed

die "Error: $errput\n" if $errput; printf "Output: $stdout\n" if $stdout;
Problem is when i reverse the lines as shown below, it prints the output and then dies but does not print the error message.
printf "Output: $stdout\n" if $stdout; die "Error: $errput\n" if $errput;
How can i make it print the stdout and the error message both?
  • Comment on Re^3: Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works
  • Select or Download Code