Skip to content

Commit

Permalink
Merge pull request #4458 from minrk/process_raw_osx
Browse files Browse the repository at this point in the history
use signalstatus if exit status is undefined
  • Loading branch information
takluyver committed Oct 29, 2013
2 parents dd39c90 + 0190bfa commit 044e9a3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion IPython/utils/_process_posix.py
Expand Up @@ -187,7 +187,16 @@ def system(self, cmd):

# We follow the subprocess pattern, returning either the exit status
# as a positive number, or the terminating signal as a negative
# number. sh returns 128+n for signals
# number.
# on Linux, sh returns 128+n for signals terminating child processes on Linux
# on BSD (OS X), the signal code is set instead
if child.exitstatus is None:
# on WIFSIGNALED, pexpect sets signalstatus, leaving exitstatus=None
if child.signalstatus is None:
# this condition may never occur,
# but let's be certain we always return an integer.
return 0
return -child.signalstatus
if child.exitstatus > 128:
return -(child.exitstatus - 128)
return child.exitstatus
Expand Down

0 comments on commit 044e9a3

Please sign in to comment.