From f021750e899f483c40691c42cf1f3988fa614f47 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 6 Mar 2016 20:27:15 +0100 Subject: [PATCH] _autoenv_ask_for_yes: handle/catch Ctrl-C and return --- autoenv.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoenv.zsh b/autoenv.zsh index fd73a83..12e058d 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -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