mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix error if hook return nothing
This commit is contained in:
parent
e4e981c0fe
commit
8ec6f2b81a
1 changed files with 7 additions and 2 deletions
|
@ -398,10 +398,15 @@ def hook_exec(path, args=None, raise_on_error=False, no_trace=False,
|
|||
errno.EIO, m18n.n('hook_exec_failed', path=path))
|
||||
|
||||
try:
|
||||
returnjson = read_json(stdreturn)
|
||||
with open(stdreturn, 'r') as f:
|
||||
if f.read() != '':
|
||||
returnjson = read_json(stdreturn)
|
||||
else:
|
||||
returnjson = {}
|
||||
except Exception as e:
|
||||
returnjson = {}
|
||||
errno.EIO, m18n.n('hook_json_return_error', path=path, msg=str(e))
|
||||
raise MoulinetteError(
|
||||
errno.EIO, m18n.n('hook_json_return_error', path=path, msg=str(e)))
|
||||
|
||||
stdreturndir = os.path.split(stdreturn)[0]
|
||||
os.remove(stdreturn)
|
||||
|
|
Loading…
Add table
Reference in a new issue