ELM-Python-Client icon indicating copy to clipboard operation
ELM-Python-Client copied to clipboard

fix: Avoid crash from calling termios.tcgetattr if stdin is no tty

Open wulmer opened this issue 1 year ago • 0 comments

Fixes https://github.com/IBM/ELM-Python-Client/issues/68

This PR makes the kbhit function return False if there is no tty attached to stdin. This is semantically correct, as there cannot be a keyboard hit if there is no tty.

Another implementation idea was to introduce something like an interactive parameter which could be controlled from the outside, but I like this implementation more as it is super compact and easy to understand, while still keeping the intended functionality of the kbhit function.

wulmer avatar Aug 28 '24 14:08 wulmer