diff options
| -rw-r--r-- | python/vyos/utils/io.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py index 13ef8709a..360fc1ffb 100644 --- a/python/vyos/utils/io.py +++ b/python/vyos/utils/io.py @@ -55,7 +55,11 @@ def ask_input(question, default='', numeric_only=False, valid_responses=[], return response def ask_yes_no(question, default=False) -> bool: - """Ask a yes/no question via input() and return their answer.""" + """Ask a yes/no question via input() and return their answer. + + If stdin is not a TTY (e.g. non-interactive scripts), returns + default without prompting. + """ from sys import stdin, stdout if not stdin.isatty(): |
