--- a/mercurial/hook.py Thu Oct 20 22:39:59 2016 +0900
+++ b/mercurial/hook.py Tue Nov 08 22:22:22 2016 +0900
@@ -258,6 +258,7 @@
sys.stderr.flush()
finally:
if _redirect and oldstdout >= 0:
+ sys.__stdout__.flush() # write hook output to stderr fd
os.dup2(oldstdout, stdoutno)
os.close(oldstdout)