mercurial/hook.py
changeset 36841 9c636ec1ef37
parent 36108 c4146cf4dd20
child 37119 d4a2e0d5d042
--- a/mercurial/hook.py	Sat Mar 10 10:27:56 2018 -0800
+++ b/mercurial/hook.py	Sat Mar 10 22:02:58 2018 -0500
@@ -265,12 +265,12 @@
                 raised = False
 
             res[hname] = r, raised
+    finally:
+        # The stderr is fully buffered on Windows when connected to a pipe.
+        # A forcible flush is required to make small stderr data in the
+        # remote side available to the client immediately.
+        util.stderr.flush()
 
-            # The stderr is fully buffered on Windows when connected to a pipe.
-            # A forcible flush is required to make small stderr data in the
-            # remote side available to the client immediately.
-            util.stderr.flush()
-    finally:
         if _redirect and oldstdout >= 0:
             util.stdout.flush()  # write hook output to stderr fd
             os.dup2(oldstdout, stdoutno)