Remove pipestatus_with_signal

This was a wrapper around status_to_signal, just because that only
handled a single argument.

Instead, just teach status_to_signal to handle multiple arguments and
be done.
This commit is contained in:
Fabian Homborg
2020-09-24 20:14:10 +02:00
parent dde8318e50
commit 293a3a628d
3 changed files with 12 additions and 19 deletions

View File

@@ -1,5 +0,0 @@
function __fish_pipestatus_with_signal --description "Print arguments from \$pipestatus replacing values with signal names where appropriate"
for pstat in $argv
__fish_status_to_signal $pstat
end
end

View File

@@ -23,7 +23,7 @@ function __fish_print_pipestatus --description "Print pipestatus for prompt"
# SIGPIPE (141 = 128 + 13) is usually not a failure, see #6375.
if not contains $last_status 0 141
set -l sep $brace_sep_color$separator$status_color
set -l last_pipestatus_string (__fish_pipestatus_with_signal $argv | string join "$sep")
set -l last_pipestatus_string (__fish_status_to_signal $argv | string join "$sep")
set -l last_status_string ""
if test $last_status -ne $argv[-1]
set last_status_string " "$status_color$last_status

View File

@@ -1,22 +1,20 @@
function __fish_status_to_signal --description "Print signal name from argument (\$status), or just argument"
if test (count $argv) -ne 1
echo "expected single argument as integer from \$status" >&2
return 1
end
if test $argv[1] -gt 128
set -l signals SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS \
for arg in $argv
if test $arg -gt 128
set -l signals SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS \
SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM \
SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP \
SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM \
SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS
set -l sigix (math $argv[1] - 128)
if test $sigix -le (count $signals)
echo $signals[$sigix]
return 0
set -l sigix (math $arg - 128)
if test $sigix -le (count $signals)
echo $signals[$sigix]
else
echo $arg
end
else
echo $arg
end
end
echo $argv[1]
return 0
end