IPC::Open3::open3(..., '-') broken
authorSalvador Fandino <sfandino@yahoo.com>
Wed, 27 Jul 2011 16:20:29 +0000 (09:20 -0700)
committerDominic Hargreaves <dom@earth.li>
Fri, 7 Sep 2012 22:18:21 +0000 (23:18 +0100)
IPC::Open3::open3($in, $out, $err, '-') is broken in 5.14.1

Because the old "return 0" used to return to user code now is wrapped inside and eval block.

This patch solves the problem.

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

index 7015d27..e238528 100644 (file)
@@ -284,11 +284,14 @@ sub _open3 {
                } else {
                    xopen \*STDERR, ">&STDOUT" if fileno(STDERR) != fileno(STDOUT);
                }
-               return 0 if ($cmd[0] eq '-');
+               return 1 if ($cmd[0] eq '-');
                exec @cmd or do {
                    local($")=(" ");
                    croak "$Me: exec of @cmd failed";
                };
+           } and do {
+                close $stat_w;
+               return 0;
            };
 
            my $bang = 0+$!;