From f0bcac6fb389927ada68e2d6539a7e3edc019125 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 17 Aug 2007 00:04:27 -0500 Subject: die if spawning a subprocess fails --- lib/IO/Pty/Easy.pm | 9 ++++----- 1 file 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}; -- cgit v1.2.3-54-g00ecf