Permalink
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (16 sloc) 477 Bytes
#!/usr/bin/perl
# Copyright 2004-2017, Paul Johnson (paul@pjcj.net)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
# __COVER__ skip_test $^O eq "MSWin32" || $] == 5.008007
# __COVER__ skip_reason Fork unreliable
$x = 1;
die unless defined ($pid = fork);
if ($pid) {
$x = 2;
waitpid $pid, 0;
} else {
$x = 3;
}
print "$x: $$\n";