Patchwork [06,of,11] chgserver: use tryunlink

login
register
mail settings
Submitter Ryan McElroy
Date March 21, 2017, 1:54 p.m.
Message ID <425d04205b98881e04a4.1490104468@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/19520/
State Accepted
Headers show

Comments

Ryan McElroy - March 21, 2017, 1:54 p.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 1490104228 25200
#      Tue Mar 21 06:50:28 2017 -0700
# Node ID 425d04205b98881e04a4f2aa6444a3305cfa51ee
# Parent  18b77e381c09564f56dafc5d2b0ec6ae826139ba
chgserver: use tryunlink

Patch

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -40,7 +40,6 @@  Config
 
 from __future__ import absolute_import
 
-import errno
 import hashlib
 import inspect
 import os
@@ -543,11 +542,7 @@  class chgunixservicehandler(object):
         # remove another server's socket file. but that's okay
         # since that server will detect and exit automatically and
         # the client will start a new server on demand.
-        try:
-            os.unlink(self._realaddress)
-        except OSError as exc:
-            if exc.errno != errno.ENOENT:
-                raise
+        util.tryunlink(self._realaddress)
 
     def printbanner(self, address):
         # no "listening at" message should be printed to simulate hg behavior