From 644a36caa7512da62cd10e50a38ad0ed819a4a4c Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sun, 4 Feb 2024 00:03:48 -0600 Subject: [PATCH] Write offending script to stderr (#i530) --- src/sos/actions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sos/actions.py b/src/sos/actions.py index ac571c5d4..33af0ae3c 100644 --- a/src/sos/actions.py +++ b/src/sos/actions.py @@ -589,6 +589,11 @@ def run(self, **kwargs): 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: