diff --git a/news/sig.rst b/news/sig.rst new file mode 100644 index 000000000..48d6b1af0 --- /dev/null +++ b/news/sig.rst @@ -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 diff --git a/xonsh/proc.py b/xonsh/proc.py index 75e07b8cf..9a3781d41 100644 --- a/xonsh/proc.py +++ b/xonsh/proc.py @@ -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."""