changeset 5647:165cda754d9e

Workaround for "Not enough space" error due to the bug of Windows. Large write requests fail when stdout is switched to binary mode. As a workaround, limit the data size to write once.
author Shun-ichi GOTO <shunichi.goto@gmail.com>
date Fri, 14 Dec 2007 16:47:41 +0100
parents c722bd73c948
children 2079faccb408
files mercurial/util.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Thu Dec 13 14:25:51 2007 -0600
+++ b/mercurial/util.py	Fri Dec 14 16:47:41 2007 +0100
@@ -919,7 +919,15 @@
 
         def write(self, s):
             try:
-                return self.fp.write(s)
+                # This is workaround for "Not enough space" error on
+                # writing large size of data to console.
+                limit = 16000
+                l = len(s)
+                start = 0
+                while start < l:
+                    end = start + limit
+                    self.fp.write(s[start:end])
+                    start = end
             except IOError, inst:
                 if inst.errno != 0: raise
                 self.close()