2022-01-28 00:21:22 +00:00
|
|
|
function fish_status_to_signal --description "Convert exit code to signal name"
|
2021-12-11 21:54:11 +00:00
|
|
|
__fish_make_completion_signals # Make sure signals are cached
|
2020-09-24 18:14:10 +00:00
|
|
|
for arg in $argv
|
|
|
|
if test $arg -gt 128
|
2021-12-11 21:54:11 +00: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-24 18:14:10 +00:00
|
|
|
else
|
|
|
|
echo $arg
|
|
|
|
end
|
|
|
|
else
|
|
|
|
echo $arg
|
2019-02-26 05:59:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
end
|