diff --git a/share/functions/__fish_print_pipestatus.fish b/share/functions/__fish_print_pipestatus.fish index 0fbf17ad6..690588fde 100644 --- a/share/functions/__fish_print_pipestatus.fish +++ b/share/functions/__fish_print_pipestatus.fish @@ -6,8 +6,10 @@ function __fish_print_pipestatus --description "Print pipestatus for prompt" set -l status_color $argv[5] set -e argv[1 2 3 4 5] - # only output $pipestatus if there was a pipe and any part of it had non-zero exit status - if set -q argv[2] && string match -qvr '^0$' $argv + # only output $pipestatus if there was a pipe + # and any part of it but the last one had non-zero exit status + # if only the last process failed, prompts already print $status which is $pipestatus[-1] + if set -q argv[2] && string match -qvr '^0$' $argv[1..-2] set -l sep (set_color normal){$brace_sep_color}{$separator}(set_color normal){$status_color} set -l last_pipestatus_string (string join "$sep" (__fish_pipestatus_with_signal $argv)) printf "%s%s%s%s%s%s%s%s%s%s" (set_color normal )$brace_sep_color $left_brace \