2021-01-03 14:15:57 +00:00
|
|
|
function fish_status_to_signal --description "Print signal name from argument (\$status), or just argument"
|
2020-09-24 18:14:10 +00:00
|
|
|
for arg in $argv
|
|
|
|
if test $arg -gt 128
|
|
|
|
set -l signals SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS \
|
2020-11-22 13:39:48 +00:00
|
|
|
SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM \
|
|
|
|
SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP \
|
|
|
|
SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM \
|
|
|
|
SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS
|
2020-09-24 18:14:10 +00:00
|
|
|
set -l sigix (math $arg - 128)
|
|
|
|
if test $sigix -le (count $signals)
|
|
|
|
echo $signals[$sigix]
|
|
|
|
else
|
|
|
|
echo $arg
|
|
|
|
end
|
|
|
|
else
|
|
|
|
echo $arg
|
2019-02-26 05:59:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
end
|