From 03d32ae9516c435d92578ffe1496e7dd5dca9738 Mon Sep 17 00:00:00 2001 From: Dmitry Guryanov Date: Thu, 11 Aug 2016 17:27:41 +0300 Subject: [PATCH] Add error message, when run not on a tty The library, which displays user interface, urwid, executes ioctl on stdin file descriptor, which works only on ttys. Let's report error, when we run not on a tty to make error investigation easier. Change-Id: I15e80f14f65f6467eca153dc2cd73c64751c9154 Partial-Bug: #1607402 --- fuelmenu/fuelmenu.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fuelmenu/fuelmenu.py b/fuelmenu/fuelmenu.py index 3067480..dcc605b 100755 --- a/fuelmenu/fuelmenu.py +++ b/fuelmenu/fuelmenu.py @@ -384,6 +384,10 @@ def main(*args, **kwargs): setup(save_only=True, managed_iface=options.iface) else: + if not os.isatty(sys.stdin.fileno()): + print("Stdin is not a tty, can't run fuelmenu " + "in interactive mode.") + sys.exit(1) setup() if '__main__' == __name__ or urwid.web_display.is_web_request():