Cannot use elmclient in Docker when no tty attached to stdin
Hi, we were trying to use the elmclient inside a Docker container, but it crashed on the first use of termios.tcgetattr, because there was no tty attached to stdin.
The error message shown is:
termios.error: (25, 'Inappropriate ioctl for device')
The error lies in the assumption that there is always a tty on stdin, so that you can check for key presses in https://github.com/IBM/ELM-Python-Client/blob/master/elmclient/oslcqueryapi.py#L682 .
You can reproduce the error by running the following command:
docker run --rm python:3 /bin/python3 -c 'import termios, sys; termios.tcgetattr(sys.stdin.fileno())'
This recreates exactly the case where the kbhit function crashes.
I'll submit a PR in a second.
Hi Wolfgang
Thanks for your PR, that's a scenario I've never tried. And it's always nice to hear that elmclient is being used :-)
Your solution looks good, it will get accepted but could be a few weeks due to vacation.
Regards Ian
it will get accepted but could be a few weeks due to vacation.
Hi Ian (@barny), the few weeks should be over by now, any chance to get the PR #69 merged? BTW: there is another PR #67 from me.
Hi - I incorporated your changes, thanks!