equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import errno |
|
11 import os |
10 import os |
12 import sys |
11 import sys |
13 import tempfile |
12 import tempfile |
14 |
13 |
15 from .i18n import _ |
14 from .i18n import _ |
58 pid = util.rundetached(runargs, condfn) |
57 pid = util.rundetached(runargs, condfn) |
59 if pid < 0: |
58 if pid < 0: |
60 raise error.Abort(_('child process failed to start')) |
59 raise error.Abort(_('child process failed to start')) |
61 writepid(pid) |
60 writepid(pid) |
62 finally: |
61 finally: |
63 try: |
62 util.tryunlink(lockpath) |
64 os.unlink(lockpath) |
|
65 except OSError as e: |
|
66 if e.errno != errno.ENOENT: |
|
67 raise |
|
68 if parentfn: |
63 if parentfn: |
69 return parentfn(pid) |
64 return parentfn(pid) |
70 else: |
65 else: |
71 return |
66 return |
72 |
67 |