summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/io.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py
index 77e30cbb0..13ef8709a 100644
--- a/python/vyos/utils/io.py
+++ b/python/vyos/utils/io.py
@@ -56,7 +56,10 @@ def ask_input(question, default='', numeric_only=False, valid_responses=[],
def ask_yes_no(question, default=False) -> bool:
"""Ask a yes/no question via input() and return their answer."""
- from sys import stdout
+ from sys import stdin, stdout
+
+ if not stdin.isatty():
+ return default
default_msg = "[Y/n]" if default else "[y/N]"
while True:
try: