This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dont report a $@ exception with uninitialized $!'s message in IPC::Open3
[perl5.git] / ext / IPC-Open3 / lib / IPC / Open3.pm
index 7c7e9b5..273f205 100644 (file)
@@ -9,7 +9,7 @@ require Exporter;
 use Carp;
 use Symbol qw(gensym qualify);
 
-$VERSION       = '1.18';
+$VERSION       = '1.19';
 @ISA           = qw(Exporter);
 @EXPORT                = qw(open3);
 
@@ -412,7 +412,11 @@ sub spawn_with_handles {
        } else {
            $pid = eval { system 1, @_ }; # 1 == P_NOWAIT
        }
-       push @errs, "IO::Pipe: Can't spawn-NOWAIT: $!" if !$pid || $pid < 0;
+       if($@) {
+           push @errs, "IO::Pipe: Can't spawn-NOWAIT: $@";
+       } elsif(!$pid || $pid < 0) {
+           push @errs, "IO::Pipe: Can't spawn-NOWAIT: $!";
+       }
     }
 
     # Do this in reverse, so that STDERR is restored first: