##// END OF EJS Templates
progress: extract stubs to restart ferr.flush() and .write() on EINTR
Yuya Nishihara -
r32048:c3ef33fd default
parent child Browse files
Show More
@@ -157,14 +157,14 b' class progbar(object):'
157 157 out = spacejoin(head, prog, tail)
158 158 else:
159 159 out = spacejoin(head, tail)
160 self.ui.ferr.write('\r' + encoding.trim(out, termwidth))
160 self._writeerr('\r' + encoding.trim(out, termwidth))
161 161 self.lasttopic = topic
162 self.ui.ferr.flush()
162 self._flusherr()
163 163
164 164 def clear(self):
165 165 if not self.printed or not self.lastprint or not shouldprint(self.ui):
166 166 return
167 self.ui.ferr.write('\r%s\r' % (' ' * self.width()))
167 self._writeerr('\r%s\r' % (' ' * self.width()))
168 168 if self.printed:
169 169 # force immediate re-paint of progress bar
170 170 self.lastprint = 0
@@ -175,9 +175,15 b' class progbar(object):'
175 175 if self.ui.configbool('progress', 'clear-complete', default=True):
176 176 self.clear()
177 177 else:
178 self.ui.ferr.write('\n')
178 self._writeerr('\n')
179 self._flusherr()
180
181 def _flusherr(self):
179 182 self.ui.ferr.flush()
180 183
184 def _writeerr(self, msg):
185 self.ui.ferr.write(msg)
186
181 187 def width(self):
182 188 tw = self.ui.termwidth()
183 189 return min(int(self.ui.config('progress', 'width', default=tw)), tw)
General Comments 0
You need to be logged in to leave comments. Login now