diff options
author | Bo Lindbergh <blgl@stacken.kth.se> | 2011-05-12 21:42:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-05-18 14:42:46 -0700 |
commit | 12a72a5a8ef940059c8665323da38720b7a53395 (patch) | |
tree | cb7a3cb1c1b7ab5502eb15b7be2949bcf77626c9 /ext | |
parent | cb8578ffae704f3e20f9f83baa8b9542a9b6add6 (diff) | |
download | perl-12a72a5a8ef940059c8665323da38720b7a53395.tar.gz |
waitpid doesn't work with WIFSTOPPED
> Quoth Emmanuel Rodriguez:
>> I'm see a strange behavior in the fonction WIFSTOPPED($?) when
>> waitpid($pid, WUNTRACED) is invoked and that the child process
>> receives a stop signal. Under this conditions one would expect that
>> WIFSTOPPED($?) would return a true value, but that's not what is
>> happening. A similar program written in C will have the same macro
>> return true instead of false under the same conditions.
>>
>> I can reproduce this with the default perl provided by Ubuntu 9.10 and
>> OS X 10.6. Which lets me guess that this is not a distro related bug.
>
> This is a documentation error. POSIX.pod incorrectly claims that
> you can pass the value of $? to WIFEXITED and its relatives.
> You must use the raw status value from ${^CHILD_ERROR_NATIVE} instead.
And here's the patch. Note that perlvar.pod gets it right already.
/Bo Lindbergh
Diffstat (limited to 'ext')
-rw-r--r-- | ext/POSIX/lib/POSIX.pod | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod index 41bbde2c88..0327d05d96 100644 --- a/ext/POSIX/lib/POSIX.pod +++ b/ext/POSIX/lib/POSIX.pod @@ -2188,33 +2188,37 @@ WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG =item WIFEXITED -WIFEXITED($?) returns true if the child process exited normally -(C<exit()> or by falling off the end of C<main()>) +WIFEXITED(${^CHILD_ERROR_NATIVE}) returns true if the child process +exited normally (C<exit()> or by falling off the end of C<main()>) =item WEXITSTATUS -WEXITSTATUS($?) returns the normal exit status of the child process -(only meaningful if WIFEXITED($?) is true) +WEXITSTATUS(${^CHILD_ERROR_NATIVE}) returns the normal exit status of +the child process (only meaningful if WIFEXITED(${^CHILD_ERROR_NATIVE}) +is true) =item WIFSIGNALED -WIFSIGNALED($?) returns true if the child process terminated because -of a signal +WIFSIGNALED(${^CHILD_ERROR_NATIVE}) returns true if the child process +terminated because of a signal =item WTERMSIG -WTERMSIG($?) returns the signal the child process terminated for -(only meaningful if WIFSIGNALED($?) is true) +WTERMSIG(${^CHILD_ERROR_NATIVE}) returns the signal the child process +terminated for (only meaningful if WIFSIGNALED(${^CHILD_ERROR_NATIVE}) +is true) =item WIFSTOPPED -WIFSTOPPED($?) returns true if the child process is currently stopped -(can happen only if you specified the WUNTRACED flag to waitpid()) +WIFSTOPPED(${^CHILD_ERROR_NATIVE}) returns true if the child process is +currently stopped (can happen only if you specified the WUNTRACED flag +to waitpid()) =item WSTOPSIG -WSTOPSIG($?) returns the signal the child process was stopped for -(only meaningful if WIFSTOPPED($?) is true) +WSTOPSIG(${^CHILD_ERROR_NATIVE}) returns the signal the child process +was stopped for (only meaningful if WIFSTOPPED(${^CHILD_ERROR_NATIVE}) +is true) =back |