Skip to content

Commit

Permalink
vyos.utils.io: T6385: handle keyboard interrupts in ask_yes_no
Browse files Browse the repository at this point in the history
and return False if the user interrupts the prompt with Ctrl-C

(cherry picked from commit 5a5dda1)
  • Loading branch information
dmbaturin authored and mergify[bot] committed May 22, 2024
1 parent 82b14fb commit 616ede0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/vyos/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 616ede0

Please sign in to comment.