Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 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 | 3da652f2039c |
comparison
equal
deleted
inserted
replaced
5646:c722bd73c948 | 5647:165cda754d9e |
---|---|
917 self.fp.close() | 917 self.fp.close() |
918 except: pass | 918 except: pass |
919 | 919 |
920 def write(self, s): | 920 def write(self, s): |
921 try: | 921 try: |
922 return self.fp.write(s) | 922 # This is workaround for "Not enough space" error on |
923 # writing large size of data to console. | |
924 limit = 16000 | |
925 l = len(s) | |
926 start = 0 | |
927 while start < l: | |
928 end = start + limit | |
929 self.fp.write(s[start:end]) | |
930 start = end | |
923 except IOError, inst: | 931 except IOError, inst: |
924 if inst.errno != 0: raise | 932 if inst.errno != 0: raise |
925 self.close() | 933 self.close() |
926 raise IOError(errno.EPIPE, 'Broken pipe') | 934 raise IOError(errno.EPIPE, 'Broken pipe') |
927 | 935 |