summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-02-03 20:02:22 -0500
committerdoy <doy@tozt.net>2009-02-03 20:02:22 -0500
commit16686a107165fa22c063d12ba42c6313a0ae1712 (patch)
treec36f7001994bf1e0e2b983263c6d157c0ba635b0
parentb60c8a20f48e8db075b0d3cbd0557295b2fa2c69 (diff)
downloadio-pty-easy-16686a107165fa22c063d12ba42c6313a0ae1712.tar.gz
io-pty-easy-16686a107165fa22c063d12ba42c6313a0ae1712.zip
move the wait() call from the SIGCHLD handler into kill(), and use IGNORE for SIGCHLD instead
-rw-r--r--lib/IO/Pty/Easy.pm8
1 files 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;
}