From 1f59558fdd95687297aba55be783657530c675a1 Mon Sep 17 00:00:00 2001 From: Marley Rae Date: Sat, 3 Feb 2024 18:42:42 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Actually=20display=20er?= =?UTF-8?q?rors,=20oops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Might be nice to be aware of things that fail, rather than show a green checkmark. --- script/utils.fish | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/utils.fish b/script/utils.fish index 68095cc..b857568 100755 --- a/script/utils.fish +++ b/script/utils.fish @@ -64,7 +64,7 @@ function print_result -a exit_code text end function print_error_stream - while read -r line + while read -l line print_error "↳ ERROR: $line" end end @@ -124,17 +124,21 @@ function execute -a cmds msg set -l tmp_file "$(mktemp /tmp/XXXXX)" - set -l exit_code 0 + set -g exit_code 0 set_trap EXIT kill_all_subproccesses fish -c "$cmds" >/dev/null 2>$tmp_file & set cmds_pid (jobs -lp) + function _exited_$cmds_pid --on-process-exit $cmds_pid -S + set -g exit_code $argv[3] + functions -e _exited_$cmds_pid + end + show_spinner $cmds_pid $cmds $msg wait $cmds_pid &>/dev/null - set exit_code $status print_result $exit_code $msg