From f43e567bf0930373e822d814ad21df3ec8b91bae Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 28 Nov 2021 16:12:24 +0100 Subject: [PATCH] apps: Remove the 'HOME' var from hook_exec env, because it's often defined in CLI but not in API because yunohost-api runs in a systemd service --- src/hook.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hook.py b/src/hook.py index 98b624f12..fbf336ed7 100644 --- a/src/hook.py +++ b/src/hook.py @@ -439,6 +439,12 @@ def _hook_exec_bash(path, args, chdir, env, user, return_format, loggers): _env = os.environ.copy() _env.update(env) + # Remove the 'HOME' var which is causing some inconsistencies between + # cli and webapi (HOME ain't defined in yunohost-api because ran from systemd) + # Apps that need the HOME var should define it in the app scripts + if "HOME" in _env: + del _env["HOME"] + returncode = call_async_output(command, loggers, shell=False, cwd=chdir, env=_env) raw_content = None