Patchwork [09,of,11] server: use tryunlink

login
register
mail settings
Submitter Ryan McElroy
Date March 21, 2017, 1:54 p.m.
Message ID <684d201e116b65e6dff5.1490104471@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/19526/
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 684d201e116b65e6dff5f9494de064591da57b07
# Parent  35955261dc137fbaa70240b3f8b63326e769d1d6
server: use tryunlink

Patch

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: