From 9f719251f5f2e1323b19d2f4ddfece98a8383b5c Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Sat, 24 Jan 2026 11:26:57 -0500 Subject: [PATCH] fix: use $pipestatus[1] in fish init to check ruby exit status $status after a pipeline reflects the last command (string collect), not the ruby program. This caused cancellation messages to be eval'd as commands: fish: Unknown command: Cancelled. in function 'try' Using $pipestatus[1] checks the actual ruby process exit status. --- spec/init_spec.md | 4 ++-- try.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/init_spec.md b/spec/init_spec.md index 58da375..6e61448 100644 --- a/spec/init_spec.md +++ b/spec/init_spec.md @@ -44,8 +44,8 @@ Key elements: ```fish function try - set -l out (/path/to/try exec --path '/default/tries/path' $argv 2>/dev/tty) - if test $status -eq 0 + set -l out (/path/to/try exec --path '/default/tries/path' $argv 2>/dev/tty | string collect) + if test $pipestatus[1] -eq 0 eval $out else echo $out diff --git a/try.rb b/try.rb index f14355a..f23d700 100755 --- a/try.rb +++ b/try.rb @@ -1015,7 +1015,7 @@ def cmd_init!(args, tries_path) fish_script = <<~SHELL function try set -l out (/usr/bin/env ruby '#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect) - if test $status -eq 0 + if test $pipestatus[1] -eq 0 eval $out else echo $out