[PATCH 12 of 14] server: use tryunlink

Ryan McElroy rm at fb.com
Mon Mar 20 22:10:55 EDT 2017


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1490062175 25200
#      Mon Mar 20 19:09:35 2017 -0700
# Node ID f405f3bb1b9686322545a61d2f8df45ff53b4527
# Parent  87d67dea66e7820d59153d74ce7cf4fe809323c9
server: use tryunlink

diff --git a/mercurial/server.py b/mercurial/server.py
--- a/mercurial/server.py
+++ b/mercurial/server.py
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import errno
 import os
 import sys
 import tempfile
@@ -60,11 +59,7 @@ def runservice(opts, parentfn=None, init
                 raise error.Abort(_('child process failed to start'))
             writepid(pid)
         finally:
-            try:
-                os.unlink(lockpath)
-            except OSError as e:
-                if e.errno != errno.ENOENT:
-                    raise
+            util.tryunlink(lockpath)
         if parentfn:
             return parentfn(pid)
         else:


More information about the Mercurial-devel mailing list