Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

Bug 935677 - Exit status reported by wait is incorrect #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions mozprocess/mozprocess/processhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,14 @@ def _wait(self):

if not self._ignore_children:
try:
# os.waitpid returns a (pid, status) tuple
return os.waitpid(self.pid, 0)[1]
# os.waitpid return value:
# > [...] a tuple containing its pid and exit status
# > indication: a 16-bit number, whose low byte is the
# > signal number that killed the process, and whose
# > high byte is the exit status (if the signal number
# > is zero)
# - http://docs.python.org/2/library/os.html#os.wait
return os.waitpid(self.pid, 0)[1] >> 8
except OSError, e:
if getattr(e, "errno", None) != 10:
# Error 10 is "no child process", which could indicate normal
Expand Down Expand Up @@ -736,6 +742,8 @@ def wait(self, timeout=None):
If timeout is not None, will return after timeout seconds.
This timeout only causes the wait function to return and
does not kill the process.

Returns the process's exit code.
"""
if self.outThread:
# Thread.join() blocks the main thread until outThread is finished
Expand Down