From 1d59738085628b49952b3e8efc5cb3bf5b875f56 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 11 May 2018 22:57:37 +0200 Subject: [PATCH] [fix] always remove lock if needed --- src/yunohost/service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index f965343d4..91b060a57 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -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