in reply to fork child exist value
Works for me. Are you sure your child is exiting with something other than zero?
$ cat a.pl use strict; use warnings; use POSIX qw( WNOHANG ); my $pid = fork(); if ($pid == 0) { sleep(5); exit $ARGV[0]; } while (waitpid($pid, WNOHANG) == 0) { sleep 1; print time(), "\n"; } print "$?\n";
$ perl a.pl 123 1288161738 1288161739 1288161740 1288161741 1288161742 31488
(31488 == 123 * 256)
|
|---|