Skip to content

Instantly share code, notes, and snippets.

@ltriant
Last active March 12, 2019 01:28
Show Gist options
  • Save ltriant/e5230f9d692125c71454266c37ac7a41 to your computer and use it in GitHub Desktop.
Save ltriant/e5230f9d692125c71454266c37ac7a41 to your computer and use it in GitHub Desktop.
#!/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