Browse Source

Ctrl-C propagation

main
deicidus 1 year ago
parent
commit
f868a864f7
  1. 3
      spells/cantrips/ask_yn

3
spells/cantrips/ask_yn

@ -11,7 +11,7 @@ else
fi
# Handle Ctrl-C
trap "printf '\n'; exit 2" 2
trap "printf '\n'; kill -s SIGINT $$" 2
# Use stty to make read command work for single character input
old_stty_cfg=$(stty -g)
@ -27,6 +27,7 @@ fi
# Print the answer and return appropriate exit code
printf "%s\n" "$(echo $answer | tr a-z A-Z" >&2
sleep 0.01 # Without this, answer gets overwritten by next echo
if [ "$answer" = "Y" -o "$answer" = "y" ]; then
exit 0
else

Loading…
Cancel
Save