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

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 8, 2018, 2:24 p.m.
Message ID <30c0af95d4461ad1da70.1541687080@mimosa>
Download mbox | patch
Permalink /patch/36471/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 8, 2018, 2:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

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()