mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
Print signal messages (closes #955)
This commit is contained in:
parent
42c8c02bc7
commit
ac806c13bd
1 changed files with 21 additions and 0 deletions
|
@ -41,6 +41,17 @@ AT_EXIT_SIGNALS = (signal.SIGABRT, signal.SIGFPE, signal.SIGILL, signal.SIGSEGV,
|
|||
if ON_POSIX:
|
||||
AT_EXIT_SIGNALS += (signal.SIGTSTP, signal.SIGQUIT, signal.SIGHUP)
|
||||
|
||||
SIGNAL_STRINGS = {
|
||||
signal.SIGABRT: 'Aborted',
|
||||
signal.SIGFPE: 'Floating point exception',
|
||||
signal.SIGILL: 'Illegal instructions',
|
||||
signal.SIGTERM: 'Terminated',
|
||||
signal.SIGSEGV: 'Segmentation fault',
|
||||
signal.SIGQUIT: 'Quit',
|
||||
signal.SIGHUP: 'Hangup',
|
||||
signal.SIGKILL: 'Killed'
|
||||
}
|
||||
|
||||
|
||||
def resetting_signal_handle(sig, f):
|
||||
"""Sets a new signal handle that will automatically restore the old value
|
||||
|
@ -599,6 +610,16 @@ def run_subproc(cmds, captured=False):
|
|||
errout = errout.replace('\r\n', '\n')
|
||||
procinfo['stderr'] = errout
|
||||
|
||||
if prev_proc.signal:
|
||||
sig, core = prev_proc.signal
|
||||
try:
|
||||
sig_str = SIGNAL_STRINGS[sig]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
if core:
|
||||
sig_str += ' (core dumped)'
|
||||
print(sig_str)
|
||||
if (not prev_is_proxy and
|
||||
hist.last_cmd_rtn is not None and
|
||||
hist.last_cmd_rtn > 0 and
|
||||
|
|
Loading…
Add table
Reference in a new issue