Subject: | scp returns false even on success if a zombie reaper is active |
Hi. Not sure if this is a bug or not. In short, a parent process has set
SIG{CHLD} = &REAPER; so we dont get zombies. This reaper automatically
reaps the child spawned in the Net::SCP::scp method causing that method
to return false even on successful scps (because the "waitpid" call
there returns -1).
As a workaround I added this line before the system call in
"Net::SCP::scp" method --
local SIG{CHLD} = 'DEFAULT';
This passes very limited testing but I do not foresee any problems with
this. Do you?
thanks,
diff -u Net/SCP.pm.07 Net/SCP.pm
--- Net/SCP.pm.07 2006-04-27 13:18:50.000000000 -0500
+++ Net/SCP.pm 2006-05-10 12:13:21.000000000 -0500
@@ -90,6 +90,8 @@
my($reader, $writer, $error ) =
( new IO::Handle, new IO::Handle, new IO::Handle );
$writer->autoflush(1);# $error->autoflush(1);
+ # pjs patch
+ local $SIG{CHLD} = 'DEFAULT';
my $pid = open3($writer, $reader, $error, @cmd );
waitpid $pid, 0;
if ( $? >> 8 ) {