Process module: exit code reporting is broken

Bug #1086323 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
New
Medium
Cezar Andrei

Bug Description

On Windows, the returned <exit-code> will always be 0. (The variable exit_code in process.cpp is never changed in the #ifdef WIN32 section.)

On Linux, <exit-code> seems to vary from distribution to distribution. On Ubuntu, it currently behaves "Correctly", in that a process which dies on a signal will return an exit code of 128 + signal number. However, on Fedora, a process that dies on a signal returns an exit code of 0. This seems to be because Ubuntu and Fedora differ in the meaning of the WEXITSTATUS() macro. As documented, this macro should only be used when WIFEXITED() reports that the child exited normally. On Fedora, this apparently is taken literally, and WEXITSTATUS() does not function at all (returning 0) if the child did not exit normally. On Ubuntu, WEXITSTATUS() does what you'd kind of want it to do, which is why the current process module code works there (the process module never checks WEXITSTATUS() and always returns whatever WEXITSTATUS() reports).

All of this behaviour is also undocumented in the process module: the module itself simply says that the <exit-code> element "returns the exit code of the child process". This needs documenting much more clearly in the case of a child that crashes, and there needs to be some cross-platform way of reporting crashes usefully.

Related branches

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.