server: use tryunlink
authorRyan McElroy <rmcelroy@fb.com>
Tue, 21 Mar 2017 06:50:28 -0700
changeset 31548 ce4ddcda868b
parent 31547 ddadb6b0b58e
child 31549 18b9d9b95719
server: use tryunlink
mercurial/server.py
--- a/mercurial/server.py	Tue Mar 21 06:50:28 2017 -0700
+++ b/mercurial/server.py	Tue Mar 21 06:50:28 2017 -0700
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import errno
 import os
 import sys
 import tempfile
@@ -60,11 +59,7 @@
                 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: