From 6dcb27144ffd1d21558725ed1bb990c1795ddca9 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 22 Oct 2024 09:02:30 +0200 Subject: [PATCH] [rf] improve subprocess calls in compute --- datalad_remake/utils/compute.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/datalad_remake/utils/compute.py b/datalad_remake/utils/compute.py index 01a9f50..19b474e 100644 --- a/datalad_remake/utils/compute.py +++ b/datalad_remake/utils/compute.py @@ -73,16 +73,10 @@ def compute( with contextlib.chdir(root_directory): if template.get('use_shell', 'false') == 'true': - lgr.debug( - f'compute: RUNNING: with shell=True: {" ".join([substituted_executable, *substituted_arguments])}' - ) - subprocess.run( - ' '.join([substituted_executable, *substituted_arguments]), - shell=True, - check=True, - ) # noqa: S602 + cmd = ' '.join([substituted_executable, *substituted_arguments]) + lgr.debug(f'compute: RUNNING: with shell=True: {cmd}') + subprocess.run(cmd, shell=True, check=True) # noqa: S602 else: - lgr.debug( - f'compute: RUNNING: {[substituted_executable, *substituted_arguments]}' - ) - subprocess.run([substituted_executable, *substituted_arguments], check=True) + cmd_list = [substituted_executable, *substituted_arguments] + lgr.debug(f'compute: RUNNING: {cmd_list}') + subprocess.run(cmd_list, check=True)