Mercurial > hg
comparison mercurial/dispatch.py @ 45253:9b5723784aac stable
dispatch: adjust ui.flush() timing to stabilize test-blackbox.t
Without this change, dispatch.dispatch() could return before flushing all
stdio data. This means chg stdio would print data after receiving the result
code.
--- tests/test-blackbox.t
+++ tests/test-blackbox.t.err
@@ -354,13 +354,13 @@
> EOF
$ hg log --debug
removing $TESTTMP/gone/.hg
- warning: cannot write to blackbox.log: $ENOENT$ (no-windows !)
warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: $ENOTDIR$ (windows !)
$ cd ..
blackbox should disable itself if track is empty
$ hg --config blackbox.track= init nothing_tracked
+ warning: cannot write to blackbox.log: $ENOENT$
$ cd nothing_tracked
$ cat >> .hg/hgrc << EOF
> [blackbox]
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 25 Jul 2020 22:51:26 +0900 |
parents | efcc87d37f4d |
children | bd2df58366b1 |
comparison
equal
deleted
inserted
replaced
45252:20d110e6eea6 | 45253:9b5723784aac |
---|---|
321 if inst.errno != errno.EPIPE: | 321 if inst.errno != errno.EPIPE: |
322 raise | 322 raise |
323 ret = -1 | 323 ret = -1 |
324 finally: | 324 finally: |
325 duration = util.timer() - starttime | 325 duration = util.timer() - starttime |
326 req.ui.flush() | 326 req.ui.flush() # record blocked times |
327 if req.ui.logblockedtimes: | 327 if req.ui.logblockedtimes: |
328 req.ui._blockedtimes[b'command_duration'] = duration * 1000 | 328 req.ui._blockedtimes[b'command_duration'] = duration * 1000 |
329 req.ui.log( | 329 req.ui.log( |
330 b'uiblocked', | 330 b'uiblocked', |
331 b'ui blocked ms\n', | 331 b'ui blocked ms\n', |
344 ) | 344 ) |
345 try: | 345 try: |
346 req._runexithandlers() | 346 req._runexithandlers() |
347 except: # exiting, so no re-raises | 347 except: # exiting, so no re-raises |
348 ret = ret or -1 | 348 ret = ret or -1 |
349 # do flush again since ui.log() and exit handlers may write to ui | |
350 req.ui.flush() | |
349 return ret | 351 return ret |
350 | 352 |
351 | 353 |
352 def _runcatch(req): | 354 def _runcatch(req): |
353 with tracing.log('dispatch._runcatch'): | 355 with tracing.log('dispatch._runcatch'): |