Repository navigation
Support nonblocking pipes on Windows #9110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -758,3 +758,34 @@ def __index__(self): | |
| assert hasattr(os, "mkfifo") | ||
| if hasattr(os, "mkfifo"): | ||
| mkfifo_paths_and_directory_descriptors() | ||
|
|
||
|
|
||
| import errno | ||
|
|
||
|
|
||
| def nonblocking_windows_pipe(): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does test_read_non_blocking cover this test? then we usaully don't add original test
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, there was overlap. |
||
| reader, writer = os.pipe() | ||
| try: | ||
| for fd in (reader, writer): | ||
| assert os.get_blocking(fd) | ||
| os.set_blocking(fd, False) | ||
| assert not os.get_blocking(fd) | ||
| os.set_blocking(fd, True) | ||
| assert os.get_blocking(fd) | ||
| os.set_blocking(fd, False) | ||
|
|
||
| assert os.read(reader, 0) == b"" | ||
| assert os.write(writer, b"") == 0 | ||
| try: | ||
| os.read(reader, 1) | ||
| except BlockingIOError as error: | ||
| assert error.errno == errno.EAGAIN | ||
| else: | ||
| raise AssertionError("empty nonblocking pipe did not raise") | ||
| finally: | ||
| os.close(reader) | ||
| os.close(writer) | ||
|
|
||
|
|
||
| if os.name == "nt": | ||
| nonblocking_windows_pipe() | ||
Uh oh!
There was an error while loading. Please reload this page.