[PATCH 2 of 8] commandserver: fix reference before assignment error in pipeservice cleanup

Yuya Nishihara yuya at tcha.org
Thu Nov 8 09:24:40 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1541597871 -32400
#      Wed Nov 07 22:37:51 2018 +0900
# Node ID 30c0af95d4461ad1da70ce0e0ad8a65ff367c128
# Parent  bd8ab1b84b2a778ea30e61a2386d2824c9a20750
commandserver: fix reference before assignment error in pipeservice cleanup

Spotted by the next patch.

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -320,8 +320,8 @@ class pipeservice(object):
         # redirect stdio to null device so that broken extensions or in-process
         # hooks will never cause corruption of channel protocol.
         with procutil.protectedstdio(ui.fin, ui.fout) as (fin, fout):
+            sv = server(ui, self.repo, fin, fout)
             try:
-                sv = server(ui, self.repo, fin, fout)
                 return sv.serve()
             finally:
                 sv.cleanup()


More information about the Mercurial-devel mailing list