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: