Skip to content

Commit

Permalink
Directly modify debug script path #1533
Browse files Browse the repository at this point in the history
  • Loading branch information
gaow committed Feb 4, 2024
1 parent 644a36c commit 9d74bcc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/sos/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9d74bcc

Please sign in to comment.