diff options
author | Daniil Baturin <daniil@baturin.org> | 2024-05-22 18:10:57 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2024-05-22 18:10:57 +0100 |
commit | 5a5dda14fd3d472680568f1792e9fbdb030f3995 (patch) | |
tree | ed87da79ed6239865ea45e5546616454cba9d724 /python/vyos/utils | |
parent | 23a420194f4d0eb0177f05bd0a8c60e4f5214e54 (diff) | |
download | vyos-1x-5a5dda14fd3d472680568f1792e9fbdb030f3995.tar.gz vyos-1x-5a5dda14fd3d472680568f1792e9fbdb030f3995.zip |
vyos.utils.io: T6385: handle keyboard interrupts in ask_yes_no
and return False if the user interrupts the prompt with Ctrl-C
Diffstat (limited to 'python/vyos/utils')
-rw-r--r-- | python/vyos/utils/io.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py index a8c430f28..205210b66 100644 --- a/python/vyos/utils/io.py +++ b/python/vyos/utils/io.py @@ -72,6 +72,8 @@ def ask_yes_no(question, default=False) -> bool: stdout.write("Please respond with yes/y or no/n\n") except EOFError: stdout.write("\nPlease respond with yes/y or no/n\n") + except KeyboardInterrupt: + return False def is_interactive(): """Try to determine if the routine was called from an interactive shell.""" |