From 766e96e41708e5bae009541f9ba1abf16bfcbfd0 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 10 Feb 2021 18:33:07 +0000 Subject: [PATCH] Fix command line building when using interpreter Partially revert commit efa9e0fdd1d11d58f4a504a3e8242cc59f3f1416 which broke tools which use `interpreter` and `&&` or environment variables in the ``. xref.: https://github.com/galaxyproject/galaxy/pull/10674/commits/efa9e0fdd1d11d58f4a504a3e8242cc59f3f1416#r573844945 --- lib/galaxy/tools/evaluation.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index be23579328d..84ca3b9f8fc 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -495,12 +495,10 @@ class ToolEvaluator: raise if interpreter: # TODO: path munging for cluster/dataset server relocatability - command_line_tokens = shlex.split(command_line) - executable = command_line_tokens[0] + executable = command_line.split()[0] tool_dir = os.path.abspath(self.tool.tool_dir) abs_executable = os.path.join(tool_dir, executable) - command_line_tokens[0:1] = [interpreter, abs_executable] - command_line = ' '.join(map(shlex.quote, command_line_tokens)) + command_line = command_line.replace(executable, f"{interpreter} {shlex.quote(abs_executable)}", 1) self.command_line = command_line def __build_config_files(self):