2022-01-28 08:21:22 +08:00
|
|
|
function fish_status_to_signal --description "Convert exit code to signal name"
|
2021-12-12 05:54:11 +08:00
|
|
|
__fish_make_completion_signals # Make sure signals are cached
|
2020-09-25 02:14:10 +08:00
|
|
|
for arg in $argv
|
|
|
|
if test $arg -gt 128
|
2021-12-12 05:54:11 +08:00
|
|
|
# Important: each element of $__kill_signals is a string like "10 USR1"
|
|
|
|
if set -l signal_names (string replace -r --filter '^'(math $arg-128)' ' SIG $__kill_signals)
|
|
|
|
# Some signals have multiple mnemonics. Pick the first one.
|
|
|
|
echo $signal_names[1]
|
2020-09-25 02:14:10 +08:00
|
|
|
else
|
|
|
|
echo $arg
|
|
|
|
end
|
|
|
|
else
|
|
|
|
echo $arg
|
2019-02-26 13:59:46 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
end
|