In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/658152ad6575e2cedee738720c447d423f6ebd25?hp=748cc03cd5ccfe4fb015da434bcb7dfb6125253b>

- Log -----------------------------------------------------------------
commit 658152ad6575e2cedee738720c447d423f6ebd25
Author: Tony Cook <[email protected]>
Date:   Mon Jul 29 16:34:07 2013 +1000

    Philip Boulain is now a perl AUTHOR, and bump a version

M       AUTHORS
M       ext/IPC-Open3/lib/IPC/Open3.pm

commit cccbbce940ea952c4c236049e98d21a011475cb1
Author: Philip Boulain <[email protected]>
Date:   Mon Sep 3 15:16:26 2012 +0100

    Reap child in case where exception has been thrown
    
    If open3 throws due to an issue such as an exec failure, the caller
    cannot know the child PID to wait for. Therefore it is our
    responsibility to reap it.
    
    Also update POD, since on some platforms exec failures now ARE raised as
    exceptions (since perlbug #72016).

M       ext/IPC-Open3/lib/IPC/Open3.pm
M       ext/IPC-Open3/t/IPC-Open3.t
-----------------------------------------------------------------------

Summary of changes:
 AUTHORS                        | 1 +
 ext/IPC-Open3/lib/IPC/Open3.pm | 6 ++++--
 ext/IPC-Open3/t/IPC-Open3.t    | 7 ++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 64a37df..1498b86 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -922,6 +922,7 @@ Petr Písař                        <[email protected]>
 Petter Reinholdtsen            <[email protected]>
 Phil Lobbes                    <[email protected]>
 Phil Monsen                    <[email protected]>
+Philip Boulain                 <[email protected]>
 Philip Hazel                   <[email protected]>
 Philip M. Gollucci             <[email protected]>
 Philip Newton                  <[email protected]>
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index 989c2f6..af1d1e0 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -9,7 +9,7 @@ require Exporter;
 use Carp;
 use Symbol qw(gensym qualify);
 
-$VERSION       = '1.14';
+$VERSION       = '1.15';
 @ISA           = qw(Exporter);
 @EXPORT                = qw(open3);
 
@@ -57,7 +57,8 @@ as file descriptors.
 open3() returns the process ID of the child process.  It doesn't return on
 failure: it just raises an exception matching C</^open3:/>.  However,
 C<exec> failures in the child (such as no such file or permission denied),
-are just reported to CHLD_ERR, as it is not possible to trap them.
+are just reported to CHLD_ERR under Windows and OS/2, as it is not possible
+to trap them.
 
 If the child process dies for any reason, the next write to CHLD_IN is
 likely to generate a SIGPIPE in the parent, which is fatal by default.
@@ -297,6 +298,7 @@ sub _open3 {
            if ($bytes_read) {
                (my $bang, $to_read) = unpack('II', $buf);
                read($stat_r, my $err = '', $to_read);
+               waitpid $kidpid, 0; # Reap child which should have exited
                if ($err) {
                    utf8::decode $err if $] >= 5.008;
                } else {
diff --git a/ext/IPC-Open3/t/IPC-Open3.t b/ext/IPC-Open3/t/IPC-Open3.t
index 7b85b82..6ab519d 100644
--- a/ext/IPC-Open3/t/IPC-Open3.t
+++ b/ext/IPC-Open3/t/IPC-Open3.t
@@ -14,10 +14,11 @@ BEGIN {
 }
 
 use strict;
-use Test::More tests => 37;
+use Test::More tests => 38;
 
 use IO::Handle;
 use IPC::Open3;
+use POSIX ":sys_wait_h";
 
 my $perl = $^X;
 
@@ -154,6 +155,10 @@ $TB->current_test($test);
     isnt($@, '',
         'open3 of a non existent program fails with an exception in the 
parent')
        or do {waitpid $pid, 0};
+    SKIP: {
+       skip 'open3 returned, our responsibility to reap', 1 unless $@;
+       is(waitpid(-1, WNOHANG), -1, 'failed exec child is reaped');
+    }
 }
 
 $pid = eval { open3 'WRITE', '', 'ERROR', '/non/existent/program'; };

--
Perl5 Master Repository

Reply via email to