Dirk80 has asked for the wisdom of the Perl Monks concerning the following question:
Hello wise monks,
I want to check the process exit status of a child program (child.pl) from my parent program. (parent.pl)
parent.pl:
my $exit_status = system("child.pl"); print "Exit Status: $exit_status\n";
child.pl:
exit(2);
The strange thing is that in the parent program the process exit code seems to be multiplicated with 256.
So in this example the printed process exit code is 512 and not 2 as I would have expected.
If I change the parent program as follows, then I get the desired result:
parent_changed.pl:my $exit_status = system("child.pl"); $exit_status /= 256; print "Exit Status: $exit_status\n";
My question is: Why is the process exit code, when I get in the parent program a multiple of 256 of the real process exit code of the child program?
Thank you.
Greetings,
Dirk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Process exit status
by Anonymous Monk on Jul 22, 2011 at 11:23 UTC | |
by Anonymous Monk on Jul 22, 2011 at 11:36 UTC | |
|
Re: Process exit status
by jethro (Monsignor) on Jul 22, 2011 at 11:29 UTC | |
|
Re: Process exit status
by JavaFan (Canon) on Jul 22, 2011 at 12:04 UTC | |
by Dirk80 (Pilgrim) on Jul 22, 2011 at 13:29 UTC | |
by JavaFan (Canon) on Jul 22, 2011 at 14:03 UTC | |
by Dirk80 (Pilgrim) on Jul 22, 2011 at 14:21 UTC | |
by Anonymous Monk on Jul 22, 2011 at 13:40 UTC | |
|
Re: Process exit status
by zentara (Cardinal) on Jul 22, 2011 at 12:47 UTC | |
by Dirk80 (Pilgrim) on Jul 22, 2011 at 13:54 UTC |