diff --git a/src/fixate/ui_cmdline/kbhit.py b/src/fixate/ui_cmdline/kbhit.py index 6c2008e..d7f3795 100644 --- a/src/fixate/ui_cmdline/kbhit.py +++ b/src/fixate/ui_cmdline/kbhit.py @@ -39,8 +39,7 @@ def __init__(self): if os.name == "nt": pass - else: - + elif os.isatty(sys.stdin.fileno()): # Save the terminal settings self.fd = sys.stdin.fileno() self.new_term = termios.tcgetattr(self.fd) @@ -59,7 +58,7 @@ def set_normal_term(self): if os.name == "nt": pass - else: + elif hasattr(self, "old_term"): termios.tcsetattr(self.fd, termios.TCSAFLUSH, self.old_term) def getch(self):