Last active
March 12, 2019 01:28
-
-
Save ltriant/e5230f9d692125c71454266c37ac7a41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use warnings; | |
use strict; | |
use EV; | |
use AnyEvent; | |
# XXX comment this out, and it works | |
{ local $SIG{CHLD}; } | |
my $done = AnyEvent->condvar; | |
my $pid = fork; | |
die "fork(): $!" if not defined $pid; | |
if ($pid == 0) { | |
exit 5; | |
} | |
my $w = AnyEvent->child( | |
pid => $pid, | |
cb => sub { | |
my ($pid, $status) = @_; | |
say "pid $pid exited with status $status"; | |
$done->send; | |
}, | |
); | |
$done->recv; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment