From d6d45cf7a6acdf2d5c3d663c8100afb8dc96264f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 5 Dec 2020 20:28:45 +0100 Subject: [PATCH] Simplify command call, no need to wrap this in a dummy 'sh -c' --- src/yunohost/hook.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/yunohost/hook.py b/src/yunohost/hook.py index 039737737..af9897851 100644 --- a/src/yunohost/hook.py +++ b/src/yunohost/hook.py @@ -390,18 +390,15 @@ def _hook_exec_bash(path, args, chdir, env, return_format, loggers): f.write('') env['YNH_STDRETURN'] = stdreturn - # Construct command to execute - command = ['sh', '-c'] - # use xtrace on fd 7 which is redirected to stdout - cmd = 'BASH_XTRACEFD=7 /bin/bash -x "{script}" {args} 7>&1' + env['BASH_XTRACEFD'] = 7 + cmd = '/bin/bash -x "{script}" {args} 7>&1' + cmd = cmd.format(script=cmd_script, args=cmd_args) - command.append(cmd.format(script=cmd_script, args=cmd_args)) - - logger.debug("Executing command '%s'" % ' '.join(command)) + logger.debug("Executing command '%s'" % cmd) returncode = call_async_output( - command, loggers, shell=False, cwd=chdir, + cmd, loggers, shell=True, cwd=chdir, stdinfo=stdinfo, env=env )