Mercurial > hg
changeset 29532:dda6bf886839
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 22 May 2016 11:21:11 +0900 |
parents | b439a2a268eb |
children | 6835777a180e |
files | hgext/chgserver.py mercurial/commandserver.py |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/chgserver.py Sat May 21 17:06:39 2016 +0900 +++ b/hgext/chgserver.py Sun May 22 11:21:11 2016 +0900 @@ -651,11 +651,8 @@ 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
--- a/mercurial/commandserver.py Sat May 21 17:06:39 2016 +0900 +++ b/mercurial/commandserver.py Sun May 22 11:21:11 2016 +0900 @@ -403,11 +403,14 @@ 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,