diff mercurial/commandserver.py @ 23323:bc374458688b

cmdserver: postpone creation of pipe server until run() This makes it easy to swap file descriptors while running command server.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Nov 2014 13:04:41 +0900
parents 000cfc8b3913
children 69f86b937035
line wrap: on
line diff
--- a/mercurial/commandserver.py	Sat Nov 15 12:43:35 2014 +0900
+++ b/mercurial/commandserver.py	Sat Nov 15 13:04:41 2014 +0900
@@ -250,13 +250,16 @@
 
 class pipeservice(object):
     def __init__(self, ui, repo, opts):
-        self.server = server(ui, repo, ui.fin, ui.fout)
+        self.ui = ui
+        self.repo = repo
 
     def init(self):
         pass
 
     def run(self):
-        return self.server.serve()
+        ui = self.ui
+        sv = server(ui, self.repo, ui.fin, ui.fout)
+        return sv.serve()
 
 class _requesthandler(SocketServer.StreamRequestHandler):
     def handle(self):