diff --git a/src/sos/actions.py b/src/sos/actions.py index 9f9ee538a..dd624ef71 100644 --- a/src/sos/actions.py +++ b/src/sos/actions.py @@ -590,6 +590,9 @@ 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(f'\nError occured when executing the following code chunk, saved to script:\n{debug_script_file}\n\n') if so is not None and so != subprocess.DEVNULL: so.close()