]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
_autoenv_ask_for_yes: handle/catch Ctrl-C and return
authorDaniel Hahler <git@thequod.de>
Sun, 6 Mar 2016 19:27:15 +0000 (20:27 +0100)
committerDaniel Hahler <git@thequod.de>
Sun, 6 Mar 2016 19:27:15 +0000 (20:27 +0100)
autoenv.zsh

index fd73a838bff60136d335e2a22c628ca36048ae22..12e058d463a34090cf94ac7c0392a6192a382bd0 100644 (file)
@@ -210,6 +210,12 @@ _autoenv_deauthorize() {
 # This function can be mocked in tests
 _autoenv_ask_for_yes() {
   local answer
+
+  # Handle/catch Ctrl-C and return, instead of letting it potentially abort the
+  # shell setup process.
+  setopt localtraps
+  trap 'return 1' INT
+
   read answer
   if [[ $answer == "yes" ]]; then
     return 0