diff options
author | Jonathan Slenders <jonathan@slenders.be> | 2016-08-04 17:15:46 +0200 |
---|---|---|
committer | Jonathan Slenders <jonathan@slenders.be> | 2016-08-04 17:17:00 +0200 |
commit | 6d30d445d49c5c8c39df9f66ba40cda3e259edeb (patch) | |
tree | 292a1cbb43559e99b14054a7fd7f87886db70615 | |
parent | 1a79ef078b1926222419ef2a663f47d223142c85 (diff) |
Bugfix for Windows: don't use select.select on a Pipe.
-rw-r--r-- | prompt_toolkit/eventloop/inputhook.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/prompt_toolkit/eventloop/inputhook.py b/prompt_toolkit/eventloop/inputhook.py index 26507d49..bab1f4c0 100644 --- a/prompt_toolkit/eventloop/inputhook.py +++ b/prompt_toolkit/eventloop/inputhook.py @@ -25,6 +25,7 @@ controls everything. from __future__ import unicode_literals import os import threading +from prompt_toolkit.utils import is_windows from .select import select_fds __all__ = ( @@ -79,7 +80,13 @@ class InputHookContext(object): # monkey patched and won't be cooperative, so that would block all # other select() calls otherwise. # See: http://www.gevent.org/gevent.os.html - select_fds([self._r], timeout=None) + + # Note: On Windows, this is apparently not an issue. + # However, if we would ever want to add a select call, it + # should use `windll.kernel32.WaitForMultipleObjects`, + # because `select.select` can't wait for a pipe on Windows. + if not is_windows(): + select_fds([self._r], timeout=None) os.read(self._r, 1024) except OSError: |