diff --git a/share/functions/__fish_pipestatus_with_signal.fish b/share/functions/__fish_pipestatus_with_signal.fish deleted file mode 100644 index 116090fa3..000000000 --- a/share/functions/__fish_pipestatus_with_signal.fish +++ /dev/null @@ -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 diff --git a/share/functions/__fish_print_pipestatus.fish b/share/functions/__fish_print_pipestatus.fish index e0e7212aa..a1efce31b 100644 --- a/share/functions/__fish_print_pipestatus.fish +++ b/share/functions/__fish_print_pipestatus.fish @@ -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 diff --git a/share/functions/__fish_status_to_signal.fish b/share/functions/__fish_status_to_signal.fish index de07dcb64..75d7b7131 100644 --- a/share/functions/__fish_status_to_signal.fish +++ b/share/functions/__fish_status_to_signal.fish @@ -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