From f868a864f76c3f4881b2b67ff648114364c0009a Mon Sep 17 00:00:00 2001 From: deicidus Date: Thu, 8 Jun 2023 12:29:59 -0700 Subject: [PATCH] Ctrl-C propagation --- spells/cantrips/ask_yn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spells/cantrips/ask_yn b/spells/cantrips/ask_yn index 42cfa39..8b85a05 100755 --- a/spells/cantrips/ask_yn +++ b/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