From 19a90b1cacb47a7bbb42e4ac7c7746885f92ac38 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 28 Jul 2015 21:39:19 +0200 Subject: [PATCH] Detect absence of a TTY, and refuse to use the CLI backend interactively in that case Fixes #2 --- cli_frontend.py | 2 ++ lilass | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cli_frontend.py b/cli_frontend.py index 5e9d400..15d081c 100644 --- a/cli_frontend.py +++ b/cli_frontend.py @@ -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) diff --git a/lilass b/lilass index 33b05fd..49dbeea 100755 --- a/lilass +++ b/lilass @@ -147,4 +147,3 @@ if __name__ == "__main__": turnOnBacklight() except Exception as e: frontend.error(str(e)) - raise -- 2.30.2