From 82c8f97d7ea5d49694b6256a388ba17c8a0cd58e Mon Sep 17 00:00:00 2001 From: Ruben Herold Date: Tue, 11 Aug 2026 22:25:10 +0200 Subject: utils: T9185: document ask_yes_no() non-tty default behavior The docstring said the function always prompts via input(), but the non-TTY fast-path added in this branch returns default without prompting. Document that. Flagged by Copilot review on PR #5390. --- python/vyos/utils/io.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(): -- cgit v1.2.3