Perl, waitpid() exit code returning wrong value?
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-05-25T22:34:09Z
Indexed on
2010/05/25
22:41 UTC
Read the original article
Hit count: 912
Consder this trivial example of fork()
ing then waiting for a child to die in Perl
#!/usr/bin/perl
use strict;
use warnings;
if (fork() == 0) {
exit(1);
}
waitpid(-1,0);
print $?;
$perl test.pl
256
I suspect the values of are being shifted upwards because when I do exit(2)
in the child, the output becomes 512
I can't seem to find this documented in perl's waitpid. Is this a bug on my system or am I doing something wrong? (btw, my OS is solaris 10)
© Stack Overflow or respective owner