Subject: | Proc::Simple somehow messes up ${^CHILD_ERROR_NATIVE} |
Date: | Sun, 27 Sep 2015 13:04:46 +0200 |
To: | bug-Proc-Simple [...] rt.cpan.org |
From: | Christoph Biedl <debian.axhn [...] manchmal.in-ulm.de> |
Hello,
creating an Proc::Simple object (and starting a process) seems to affect
the outcome of running another child process using system(): The
${^CHILD_ERROR_NATIVE} variable is set to -1 even if the child exited
zero, breaking code that checks it. The Test::Command module does.
Reproducer:
===================================================================
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
use Proc::Simple;
my $p = Proc::Simple->new;
$p->start (sub { sleep 5; });
is (${^CHILD_ERROR_NATIVE}, 0, 'CHILD_ERROR_NATIVE value before system()');
system ('true');
is (${^CHILD_ERROR_NATIVE}, 0, 'CHILD_ERROR_NATIVE value after system()');
is ($?, 0, 'child exit code');
done_testing;
===================================================================
Expected: Pass. Comment the '$p->start' line to see it working.
Observed behaviour: Check 2 of 3 fails.
Tested using Debian squeeze (Proc::Simple 1.26) and Debian stretch
(Proc::Simple 1.31).
Workaround: Don't use system, use another Proc::Simple and ->wait
instead. This however means I'd have to avoid Test::Command altogether.
FWIW, the fix suggested in #43276 did not help.
Christoph
Message body not shown because it is not plain text.