comparison hgext/chgserver.py @ 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 6011ad3b0a42
comparison
equal deleted inserted replaced
29531:b439a2a268eb 29532:dda6bf886839
649 return 649 return
650 tempaddress = _tempaddress(self.baseaddress) 650 tempaddress = _tempaddress(self.baseaddress)
651 os.symlink(os.path.basename(self.address), tempaddress) 651 os.symlink(os.path.basename(self.address), tempaddress)
652 util.rename(tempaddress, self.baseaddress) 652 util.rename(tempaddress, self.baseaddress)
653 653
654 def run(self): 654 def _cleanup(self):
655 try: 655 self.server.unlinksocketfile()
656 self.server.serve_forever()
657 finally:
658 self.server.unlinksocketfile()
659 656
660 def uisetup(ui): 657 def uisetup(ui):
661 commandserver._servicemap['chgunix'] = chgunixservice 658 commandserver._servicemap['chgunix'] = chgunixservice
662 659
663 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will 660 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will