Detect absence of a TTY, and refuse to use the CLI backend interactively in that...
[lilass.git] / cli_frontend.py
index 5e9d400537ff3b6d6eecff624cd0662f0ead2406..15d081c06fb427dc0d3a9bcc7051713f13e41ac2 100644 (file)
@@ -26,6 +26,8 @@ class CLIFrontend(QuestionFrontend):
         print(message, file=sys.stderr)
 
     def userChoose (self, title, choices, returns, fallback):
+        if not sys.stdin.isatty():
+            raise Exception("Choosing the setup interactively is not possible, due to lack of a TTY")
         while True:
             # print question
             print(title)