From a26a57839634fdcbe572b5a4cdf2a2759a5d5c02 Mon Sep 17 00:00:00 2001 From: Alexander Cherniuk Date: Fri, 6 Aug 2010 15:36:30 +0300 Subject: [PATCH] A bit more intelligent behavior for the execute --- src/command_system/implementation/execute.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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