summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2024-05-22 18:10:57 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-05-22 18:14:04 +0000
commit616ede08a69a8f42c23b648f41997914e660a943 (patch)
tree22f59184b73580d273e551990ea1e91b5e3fd720 /python
parent82b14fb2bb89eb93eb9b5275b1d94d1bc61d0806 (diff)
downloadvyos-1x-616ede08a69a8f42c23b648f41997914e660a943.tar.gz
vyos-1x-616ede08a69a8f42c23b648f41997914e660a943.zip
vyos.utils.io: T6385: handle keyboard interrupts in ask_yes_no
and return False if the user interrupts the prompt with Ctrl-C (cherry picked from commit 5a5dda14fd3d472680568f1792e9fbdb030f3995)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/io.py2
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."""