[PATCH 4 of 4] commandserver: extract _cleanup() hook to clarify chg is doing differently
Yuya Nishihara
yuya at tcha.org
Wed Jul 13 08:09:35 EDT 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1463883671 -32400
# Sun May 22 11:21:11 2016 +0900
# Node ID 909c25383f481b87502b3786f681814ff4619e5b
# Parent 5bd15cd2fed4991214c460875d41a88c8919a829
commandserver: extract _cleanup() hook to clarify chg is doing differently
This makes it clear that chg needs its own way to unlink closed socket file.
I made a mistake in draft patches without noting the difference.
diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -651,11 +651,8 @@ class chgunixservice(commandserver.unixs
os.symlink(os.path.basename(self.address), tempaddress)
util.rename(tempaddress, self.baseaddress)
- def run(self):
- try:
- self.server.serve_forever()
- finally:
- self.server.unlinksocketfile()
+ def _cleanup(self):
+ self.server.unlinksocketfile()
def uisetup(ui):
commandserver._servicemap['chgunix'] = chgunixservice
diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -403,11 +403,14 @@ class unixservice(object):
self.ui.status(_('listening at %s\n') % self.address)
self.ui.flush() # avoid buffering of status message
+ def _cleanup(self):
+ os.unlink(self.address)
+
def run(self):
try:
self.server.serve_forever()
finally:
- os.unlink(self.address)
+ self._cleanup()
_servicemap = {
'pipe': pipeservice,
More information about the Mercurial-devel
mailing list