mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] always remove lock if needed
This commit is contained in:
parent
7435cfdea3
commit
1d59738085
1 changed files with 6 additions and 3 deletions
|
@ -530,14 +530,17 @@ def _run_service_command(action, service):
|
|||
PID = _give_lock(action, service, p)
|
||||
# Wait for the command to complete
|
||||
p.communicate()
|
||||
# Remove the lock if one was given
|
||||
if need_lock and PID != 0:
|
||||
_remove_lock(PID)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
# TODO: Log output?
|
||||
logger.warning(m18n.n('service_cmd_exec_failed', command=' '.join(e.cmd)))
|
||||
return False
|
||||
|
||||
finally:
|
||||
# Remove the lock if one was given
|
||||
if need_lock and PID != 0:
|
||||
_remove_lock(PID)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue