From 6149434ecaf7dec59f62f7a3962c19445193da9a Mon Sep 17 00:00:00 2001
From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de>
Date: Fri, 11 Aug 2023 16:17:47 +0200
Subject: [PATCH] use subshell to ensure the redirect happens for all command

---
 src/mpsd_software_manager/mpsd_software.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mpsd_software_manager/mpsd_software.py b/src/mpsd_software_manager/mpsd_software.py
index 6cd8565..29dfd3e 100755
--- a/src/mpsd_software_manager/mpsd_software.py
+++ b/src/mpsd_software_manager/mpsd_software.py
@@ -1213,7 +1213,7 @@ def remove_spack_environment(spack_dir, environment_name, build_log_path=None):
     ]
     build_log_path = build_log_path or "/dev/null"
     run(
-        " && ".join(commands_to_execute) + f" 2>&1 |tee {build_log_path}",
+        "(" + " && ".join(commands_to_execute) + f") 2>&1 |tee {build_log_path}",
         shell=True,
         check=True,
     )
@@ -1242,7 +1242,7 @@ def remove_spack_package(spack_dir, package, build_log_path=None):
         f"spack uninstall -y {package}",
     ]
     run(
-        " && ".join(commands_to_execute) + f" 2>&1 |tee {build_log_path}",
+        "(" + " && ".join(commands_to_execute) + f") 2>&1 |tee {build_log_path}",
         shell=True,
         check=True,
     )
-- 
GitLab