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

This commit is contained in:
Alexandre Aubin 2021-11-28 16:12:24 +01:00
parent a399675f60
commit f43e567bf0

View file

@ -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