mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Woopsies ... cannot use check_call because we need a non-block call. Also Popen won't trigger a CalledProcessError
This commit is contained in:
parent
cbcd60a41d
commit
442bd8c3e4
1 changed files with 4 additions and 5 deletions
|
@ -663,7 +663,7 @@ def _run_service_command(action, service):
|
|||
try:
|
||||
# Launch the command
|
||||
logger.debug("Running '%s'" % cmd)
|
||||
p = subprocess.check_call(cmd.split(), stderr=subprocess.STDOUT)
|
||||
p = subprocess.Popen(cmd.split(), stderr=subprocess.STDOUT)
|
||||
# If this command needs a lock (because the service uses yunohost
|
||||
# commands inside), find the PID and add a lock for it
|
||||
if need_lock:
|
||||
|
@ -671,10 +671,9 @@ def _run_service_command(action, service):
|
|||
# Wait for the command to complete
|
||||
p.communicate()
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
# TODO: Log output?
|
||||
logger.warning(m18n.n('service_cmd_exec_failed', command=' '.join(e.cmd)))
|
||||
return False
|
||||
if p.returncode != 0:
|
||||
logger.warning(m18n.n('service_cmd_exec_failed', command=cmd))
|
||||
return False
|
||||
|
||||
finally:
|
||||
# Remove the lock if one was given
|
||||
|
|
Loading…
Add table
Reference in a new issue