diff --git a/src/command_system/implementation/execute.py b/src/command_system/implementation/execute.py index 0e95c67bd..2ebdef64b 100644 --- a/src/command_system/implementation/execute.py +++ b/src/command_system/implementation/execute.py @@ -83,10 +83,11 @@ class Execute(CommandContainer): @classmethod def terminated(cls, processor, popen): stdout, stderr = cls.fetch(popen) - if stdout: + success = popen.returncode == 0 + if success and stdout: processor.echo(stdout) - elif stderr: - processor.echo(stderr) + elif not success and stderr: + processor.echo_error(stderr) @classmethod def overdue(cls, processor, popen): @@ -112,7 +113,8 @@ class Show(Execute): @classmethod def terminated(cls, processor, popen): stdout, stderr = cls.fetch(popen) - if stdout: + success = popen.returncode == 0 + if success and stdout: processor.send(stdout) - elif stderr: - processor.send(stderr) \ No newline at end of file + elif not success and stderr: + processor.echo_error(stderr) \ No newline at end of file