summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-08-17 00:04:27 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-08-17 00:04:27 -0500
commitf0bcac6fb389927ada68e2d6539a7e3edc019125 (patch)
tree1a64145d0fc30b01170eac397de0afdba4c445e0
parentae082a1a75dad1d0d02b39f8b59709ec2f8eecac (diff)
downloadio-pty-easy-f0bcac6fb389927ada68e2d6539a7e3edc019125.tar.gz
io-pty-easy-f0bcac6fb389927ada68e2d6539a7e3edc019125.zip
die if spawning a subprocess fails
-rw-r--r--lib/IO/Pty/Easy.pm9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index 488b776..89756a0 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -144,7 +144,8 @@ sub spawn {
close $slave;
{ exec(@_) };
print $writep $! + 0;
- croak "Cannot exec(@_): $!";
+ carp "Cannot exec(@_): $!";
+ exit 1;
}
close $writep;
@@ -156,16 +157,14 @@ sub spawn {
my $errno;
my $read_bytes = sysread($readp, $errno, 256);
unless (defined $read_bytes) {
- carp "Cannot sync with child: $!";
kill TERM => $self->{pid};
close $readp;
- return;
+ croak "Cannot sync with child: $!";
}
close $readp;
if ($read_bytes > 0) {
$errno = $errno + 0;
- carp "Cannot exec(@_): $errno";
- return;
+ croak "Cannot exec(@_): $errno";
}
my $pid = $self->{pid};