IPC-Run
IPC-Run copied to clipboard
parent killed(?) if child exits early [rt.cpan.org #81928]
trafficstars
Migrated from rt.cpan.org#81928 (status was 'new')
Requestors:
From [email protected] on 2012-12-12 14:57:07:
Hi,
there seems to be a race condition with using "run". If the child exits very quickly, the parent disappears.
Example:
use IPC::Run qw( run timeout );
my $in="\n"; my $out; my $err;
print "calling run: ";
run [ "sh", "-c", "exit 7" ], \$in, \$out, \$err, timeout(7);
print "done\n";
Sometimes the parent survives, but most of the time the final "print" is not reached. With an additional delay everything works fine:
use IPC::Run qw( run timeout );
my $in="\n"; my $out; my $err;
print "calling run: ";
run [ "sh", "-c", "sleep 1; exit 7" ], \$in, \$out, \$err, timeout(7);
print "done\n";
From [email protected] on 2012-12-12 15:02:48:
On Wed Dec 12 09:57:07 2012, m.f. wrote:
> Hi,
>
> there seems to be a race condition with using "run". If the child exits
> very quickly, the parent disappears.
platform info:
Ubuntu 12.04 x64: perl 5.14.2, IPC::Run 0.90
SuSE 10.0 i586: perl 5.8.8, IPC::Run 0.92
I agree this happens. I have no suggestion how to fix it at this time. Patches welcome.