##// END OF EJS Templates
profiling: flush stdout before writing profile to stderr...
Kyle Lippincott -
r44653:d6d41708 default
parent child Browse files
Show More
@@ -186,6 +186,7 b' class profile(object):'
186 self._output = None
186 self._output = None
187 self._fp = None
187 self._fp = None
188 self._fpdoclose = True
188 self._fpdoclose = True
189 self._flushfp = None
189 self._profiler = None
190 self._profiler = None
190 self._enabled = enabled
191 self._enabled = enabled
191 self._entered = False
192 self._entered = False
@@ -246,6 +247,8 b' class profile(object):'
246 else:
247 else:
247 self._fpdoclose = False
248 self._fpdoclose = False
248 self._fp = self._ui.ferr
249 self._fp = self._ui.ferr
250 # Ensure we've flushed fout before writing to ferr.
251 self._flushfp = self._ui.fout
249
252
250 if proffn is not None:
253 if proffn is not None:
251 pass
254 pass
@@ -265,6 +268,7 b' class profile(object):'
265 def __exit__(self, exception_type, exception_value, traceback):
268 def __exit__(self, exception_type, exception_value, traceback):
266 propagate = None
269 propagate = None
267 if self._profiler is not None:
270 if self._profiler is not None:
271 self._uiflush()
268 propagate = self._profiler.__exit__(
272 propagate = self._profiler.__exit__(
269 exception_type, exception_value, traceback
273 exception_type, exception_value, traceback
270 )
274 )
@@ -280,3 +284,7 b' class profile(object):'
280 def _closefp(self):
284 def _closefp(self):
281 if self._fpdoclose and self._fp is not None:
285 if self._fpdoclose and self._fp is not None:
282 self._fp.close()
286 self._fp.close()
287
288 def _uiflush(self):
289 if self._flushfp:
290 self._flushfp.flush()
General Comments 0
You need to be logged in to leave comments. Login now