changeset 4129:e817c68edfed

stdout raises EINVAL when flush() is called on a closed pipe under win32. Maybe the exception should be caught and translated at raise location instead (sshserver.py).
author Patrick Mezard <pmezard@gmail.com>
date Mon, 19 Feb 2007 10:32:46 +0100
parents 43d8f7466920
children 178007785be8
files mercurial/util.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -741,6 +741,14 @@ if os.name == 'nt':
                 if inst.errno != 0: raise
                 self.close()
                 raise IOError(errno.EPIPE, 'Broken pipe')
+                
+        def flush(self):
+            try:
+                return self.fp.flush()
+            except IOError, inst:
+                if inst.errno != errno.EINVAL: raise
+                self.close()
+                raise IOError(errno.EPIPE, 'Broken pipe')
 
     sys.stdout = winstdout(sys.stdout)