system返回值

system返回值

如果有捕获CHLD信号时,在子程序中不管调用system成功与否都返回-1,
没有捕获CHLD,成功返回0,失败就返回256

那这样如何在捕获CHLD信号时,判断system调用是否成功??

系统是bsd6.2

文档里这么说的,好像跟CHLD信号无关把:

The return value is the exit status of the program as returned by the wait call. To get the actual exit value, shift right by eight (see below). See also exec. This is not what you want to use to capture the output from a command, for that you should use merely backticks or qx//, as described in `STRING` in the perlop manpage. Return value of -1 indicates a failure to start the program or an error of the wait(2) system call (inspect $! for the reason).