I found on Centos4 that the man page for popen() states in part:
DESCRIPTION
The pclose() function shall close a stream that was opened by popen(), wait for the command to termi-
nate, and return the termination status of the process that was running the command language inter-
preter. However, if a call caused the termination status to be unavailable to pclose(), then pclose()
shall return -1 with errno set to [ECHILD] to report this situation.
However, in my C++ application, when I actually execute the code, I see that the termination status is shifted left by 8 bits. Perhaps this is to distinguish a -1 from the pipe's termination status from pclose()'s own exit status of -1?
Is this portable behavior? Why doesn't the man page mention this? If not portable, which platforms conform to this behavior?