Skip to content

Commit

Permalink
Merge pull request #198 from PyFixate/167-tests-fail-on-macos
Browse files Browse the repository at this point in the history
Fix #167: Check if stdin is a terminal before calling termios on it
  • Loading branch information
josh-marshall-amp authored Jul 22, 2024
2 parents 8516d77 + 4945598 commit dd5ea1f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/fixate/ui_cmdline/kbhit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit dd5ea1f

Please sign in to comment.