jefftanner Posted January 8, 2008 Share Posted January 8, 2008 I am using PHP process controls, and I want to get a "human readable" string based upon exit status. Is there such a function? Example code: $cid = pcntl_wait($status); //Protect against Zombie children print "we are in parent $pid post wait child $cid AFTER\n"; print "pid child $cid -- status $status.\n"; if(pcntl_wifexited($status)) { $exit_code = pcntl_wexitstatus($status); print "pid child $cid returned exit code: $exit_code.\n"; } else if (pcntl_wifstopped($status)) { $stop_signal = pcntl_wstopsig($status); print "pid child $cid is currently stopped: $stop_signal.\n"; } else if (pcntl_wifsignaled($status)) { $terminate_signal = pcntl_wtermsig($status); print "pid child $cid terminated due to a signal $terminate_signal.\n"; } else { print "child $cid was unnaturally terminated.\n"; } So for each of these stopped, terminated, and exit codes, I want an interpretation in string form. Quote Link to comment https://forums.phpfreaks.com/topic/85100-acquire-human-readable-string-when-given-an-exit-codes-post-pcntl_wait/ Share on other sites More sharing options...
btherl Posted January 9, 2008 Share Posted January 9, 2008 I don't think there is .. if there was, it would be mentioned in the pcntl documentation somewhere. You can use the signal constants though, like SIGSTOP, SIGHUP, etc etc. For exit status, that is defined by the application, so there is never a standard string representation of that. Quote Link to comment https://forums.phpfreaks.com/topic/85100-acquire-human-readable-string-when-given-an-exit-codes-post-pcntl_wait/#findComment-434110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.