mercurial/windows.py
changeset 38601 af8d8513d7de
parent 38483 3efadf2317c7
parent 38533 3a0f322af192
child 38627 93ed193bc03e
--- a/mercurial/windows.py	Fri Jul 06 17:57:46 2018 +0200
+++ b/mercurial/windows.py	Mon Jul 09 09:50:23 2018 -0400
@@ -173,7 +173,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')
@@ -182,7 +182,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')