A child process can:
- Exit normally (by exiting using
exit(0)
,exit(22)
,exit(23)
) -- This is obviously specific to my application - Exit abnormally (code throws an exception, receives an unhandled signal, core dumps, etc...)
I am doing a fork/exec from a parent process and looping on waitpid
, when I detect that child process has exited I would like to determine the reason it exited.
Currently I check WEXITSTATUS(status)
(where status
is returned by waitpid
) to determine exit code.
Is there a way to reliably detect if child exited abnormally?