From 9d74bccc50c10472007ce6df01bd0be7c8f4ca3f Mon Sep 17 00:00:00 2001 From: Gao Wang Date: Sun, 4 Feb 2024 08:09:49 -0500 Subject: [PATCH] Directly modify debug script path #1533 --- src/sos/actions.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sos/actions.py b/src/sos/actions.py index 33af0ae3c..9f9ee538a 100644 --- a/src/sos/actions.py +++ b/src/sos/actions.py @@ -411,8 +411,10 @@ def run(self, **kwargs): else: raise RuntimeError(f"Unacceptable interpreter {self.interpreter}") + debug_script_path = os.path.dirname(os.path.abspath(kwargs["stderr"])) if ("stderr" in kwargs and kwargs["stderr"] is not False and + os.path.isdir(os.path.dirname(os.path.abspath(kwargs["stderr"])))) else env.exec_dir debug_script_file = os.path.join( - env.exec_dir, + debug_script_path, f'{env.sos_dict["step_name"]}_{env.sos_dict["_index"]}_{str(uuid.uuid4())[:8]}{self.suffix}', ) # with open(debug_script_file, 'w') as sfile: @@ -587,13 +589,8 @@ def run(self, **kwargs): se = subprocess.DEVNULL p = subprocess.Popen(cmd, shell=True, stderr=se, stdout=so) - ret = p.wait() - if ret != 0: - # write an error message to stderr - se.write('\nError occured when executing the following script:\n\n{self.script}\n\n') - if so is not None and so != subprocess.DEVNULL: so.close() if se is not None and se != subprocess.DEVNULL: