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
This commit is contained in:
Dmitry Guryanov 2016-08-11 17:27:41 +03:00
parent 1da4d4f45c
commit 03d32ae951
1 changed files with 4 additions and 0 deletions

View File

@ -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():