mercurial/windows.py
branchstable
changeset 38533 3a0f322af192
parent 37460 a6c6b7beb025
child 38601 af8d8513d7de
--- a/mercurial/windows.py	Tue Jul 03 12:10:22 2018 -0400
+++ b/mercurial/windows.py	Wed Jul 04 14:19:13 2018 +0200
@@ -172,7 +172,7 @@
                 self.fp.write(s[start:end])
                 start = end
         except IOError as inst:
-            if inst.errno != 0:
+            if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
                 raise
             self.close()
             raise IOError(errno.EPIPE, 'Broken pipe')
@@ -181,7 +181,7 @@
         try:
             return self.fp.flush()
         except IOError as inst:
-            if inst.errno != errno.EINVAL:
+            if not win32.lasterrorwaspipeerror(inst):
                 raise
             raise IOError(errno.EPIPE, 'Broken pipe')