If you press Ctrl-C (SIGINT) while gum is waiting on input, it now prints the string "user aborted".
This is new in 0.14.0. Before this version it didn't print anything on SIGINT.
local chosen=$(gum choose a b c)
# Before 0.14.0 you could just check if the variable was empty
if [ -z "$chosen" ]; then
# Use aborted the prompt.
return
fi
# But when using 0.14.0, I had to add an extra check
if [ -z "$chosen" ] || [ "$chosen" = "user aborted" ]; then
# Use aborted the prompt.
return
fi
# This becomes even more difficult to deal with when you ask for multiple choices
local things=("a" "b" "c")
local arr=($(gum choose --header "Select multiple:" --no-limit "${things[@]}"))
if [ "${#arr[@]}" -eq 2 ] && [ "${arr[1]}" = "user" ] && [ "${arr[2]}" = "aborted" ]; then
# Use aborted the prompt.
return
fi
# If `gum choose` instead printed nothing in the previous example then I could just check the length of the array:
if [ "${#arr[@]}" -eq 0 ]; then
# Use aborted the prompt.
return
fi
To Reproduce
Run this gum choose a b c (don't make a choice)
Press Ctrl-C
It prints "user aborted"
Expected behavior
It should not print anything if the user aborts the prompt.
Desktop (please complete the following information):
OS: macOS
Additional context
gum version 0.14.0 installed with brew
I use gum input | grep -v "^user aborted$" to solve this issue for now, but I would prefer if the "user aborted" error was never printed in the first place.
Describe the bug
If you press Ctrl-C (SIGINT) while gum is waiting on input, it now prints the string "user aborted".
This is new in 0.14.0. Before this version it didn't print anything on SIGINT.
To Reproduce
gum choose a b c
(don't make a choice)Expected behavior It should not print anything if the user aborts the prompt.
Desktop (please complete the following information):
Additional context gum version 0.14.0 installed with brew