Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hook.py @ 36849:9c636ec1ef37
hook: ensure stderr is flushed when an exception is raised, for test stability
Windows has had issues with output order in test-ssh-proto-unbundle.t[1] since
it was created a few weeks ago. Each of the problems occurred when an exception
was thrown out of the hook.
Now the only thing blocking D2720 is the fact that the "abort: ..." lines on
stderr are totally AWOL. I have no idea where there are.
[1] https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/541/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 10 Mar 2018 22:02:58 -0500 |
parents | c4146cf4dd20 |
children | d4a2e0d5d042 |
comparison
equal
deleted
inserted
replaced
36848:ef68493d652b | 36849:9c636ec1ef37 |
---|---|
263 else: | 263 else: |
264 r = _exthook(ui, repo, htype, hname, cmd, args, throw) | 264 r = _exthook(ui, repo, htype, hname, cmd, args, throw) |
265 raised = False | 265 raised = False |
266 | 266 |
267 res[hname] = r, raised | 267 res[hname] = r, raised |
268 | |
269 # The stderr is fully buffered on Windows when connected to a pipe. | |
270 # A forcible flush is required to make small stderr data in the | |
271 # remote side available to the client immediately. | |
272 util.stderr.flush() | |
273 finally: | 268 finally: |
269 # The stderr is fully buffered on Windows when connected to a pipe. | |
270 # A forcible flush is required to make small stderr data in the | |
271 # remote side available to the client immediately. | |
272 util.stderr.flush() | |
273 | |
274 if _redirect and oldstdout >= 0: | 274 if _redirect and oldstdout >= 0: |
275 util.stdout.flush() # write hook output to stderr fd | 275 util.stdout.flush() # write hook output to stderr fd |
276 os.dup2(oldstdout, stdoutno) | 276 os.dup2(oldstdout, stdoutno) |
277 os.close(oldstdout) | 277 os.close(oldstdout) |
278 | 278 |