From 16686a107165fa22c063d12ba42c6313a0ae1712 Mon Sep 17 00:00:00 2001 From: doy Date: Tue, 3 Feb 2009 20:02:22 -0500 Subject: move the wait() call from the SIGCHLD handler into kill(), and use IGNORE for SIGCHLD instead --- lib/IO/Pty/Easy.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm index 4cf1973..397bf6d 100644 --- a/lib/IO/Pty/Easy.pm +++ b/lib/IO/Pty/Easy.pm @@ -129,8 +129,7 @@ sub spawn { # if the exec fails, signal the parent by sending the errno across the pipe # if the exec succeeds, perl will close the pipe, and the sysread will # return due to EOF - sub sigchld { wait; $SIG{CHLD} = \&sigchld; } - $SIG{CHLD} = \&sigchld; + $SIG{CHLD} = 'IGNORE'; $self->{pid} = fork; unless ($self->{pid}) { close $readp; @@ -282,7 +281,10 @@ sub kill { $sig = "TERM" unless defined $sig; my $kills = kill $sig => $self->{pid} if $self->is_active; - $self->_wait_for_inactive unless $non_blocking; + if (!$non_blocking) { + wait; + $self->_wait_for_inactive unless $non_blocking; + } return $kills; } -- cgit v1.2.3-54-g00ecf