Skip to content

Commit 6ee9fd6

Browse files
committed
fixed win32 version's handling of BrokenPipeError
1 parent 502bed2 commit 6ee9fd6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/namedpipe/_win32.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ def readinto(self, b: WritableBuffer) -> Union[int, None]:
230230
hr, res = win32file.ReadFile(self.handle, size - nread)
231231
if hr in (winerror.ERROR_MORE_DATA, winerror.ERROR_IO_PENDING):
232232
raise _win_error(hr)
233-
except pywintypes.error:
234-
if win32api.GetLastError() == winerror.ERROR_BROKEN_PIPE:
233+
except pywintypes.error as e:
234+
if e.args[0] == 109: # broken pipe error
235235
break
236-
raise
236+
else:
237+
raise e
237238
if not len(res):
238239
break
239240
nnext = nread + len(res)

0 commit comments

Comments
 (0)