fixed segfault regression

This commit is contained in:
Anthony Scopatz 2016-12-22 15:19:30 -08:00
parent 95052761b5
commit ec3882b987
2 changed files with 26 additions and 1 deletions

14
news/sig.rst Normal file
View file

@ -0,0 +1,14 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Segfaults and other early exit signals are now reported correctly,
again.
**Security:** None

View file

@ -872,6 +872,16 @@ class PopenThread(threading.Thread):
"""Process return code."""
return self.proc.returncode
@property
def signal(self):
"""Process signal, or None."""
s = getattr(self.proc, "signal", None)
if s is None:
rtn = self.returncode
if rtn is not None and rtn != 0:
s = (-1*rtn, os.WCOREDUMP(rtn))
return s
def send_signal(self, signal):
"""Dispatches to Popen.send_signal()."""
dt = 0.0
@ -1982,7 +1992,8 @@ class CommandPipeline:
if core:
sig_str += ' (core dumped)'
print(sig_str, file=sys.stderr)
self.errors += sig_str + '\n'
if self.errors is not None:
self.errors += sig_str + '\n'
def _apply_to_history(self):
"""Applies the results to the current history object."""