summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-08-17 18:27:23 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-08-17 18:27:23 -0500
commitd6ed1f43c55212b529c539032076ca90c5a041d2 (patch)
tree7d9ac450cf3e3379a091c24d065d03d7fc86c892
parent1757478ae658a89400792db79651ccbf4a422ed2 (diff)
downloadio-pty-easy-d6ed1f43c55212b529c539032076ca90c5a041d2.tar.gz
io-pty-easy-d6ed1f43c55212b529c539032076ca90c5a041d2.zip
make spawn wait for the child to die before returning if there was an error
-rw-r--r--lib/IO/Pty/Easy.pm2
-rw-r--r--t/004-undefined-program.t3
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index 64e09e8..ac72818 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -161,11 +161,13 @@ sub spawn {
unless (defined $read_bytes) {
kill TERM => $self->{pid};
close $readp;
+ $self->_wait_for_inactive;
croak "Cannot sync with child: $!";
}
close $readp;
if ($read_bytes > 0) {
$errno = $errno + 0;
+ $self->_wait_for_inactive;
croak "Cannot exec(@_): $errno";
}
diff --git a/t/004-undefined-program.t b/t/004-undefined-program.t
index 6a50f3b..8ecf475 100644
--- a/t/004-undefined-program.t
+++ b/t/004-undefined-program.t
@@ -7,7 +7,4 @@ use IO::Pty::Easy;
my $pty = new IO::Pty::Easy;
eval { $pty->spawn("missing_program_io_pty_easy") };
like($@, qr/Cannot exec\(missing_program_io_pty_easy\)/);
-TODO: {
-local $TODO = "spawn() needs to block on is_active until SIGCHLD is received if it fails";
ok(!$pty->is_active, "pty isn't active if program doesn't exist");
-}