From cc4d90d42e46e3c96a44c18819bc609e782727da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Thu, 14 Feb 2013 15:17:17 +0100 Subject: [PATCH] commands: if there is no stderr output of failed command, show stdout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jaroslav Škarvada --- tuned/utils/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tuned/utils/commands.py b/tuned/utils/commands.py index c01f267..67f2e5f 100644 --- a/tuned/utils/commands.py +++ b/tuned/utils/commands.py @@ -44,7 +44,10 @@ def execute(args): out, err = proc.communicate() if proc.returncode: - log.error("Executing %s error: %s" % (args[0], err[:-1])) + err_out = err[:-1] + if len(err_out) == 0: + err_out = out[:-1] + log.error("Executing %s error: %s" % (args[0], err_out)) except (OSError,IOError) as e: log.error("Executing %s error: %s" % (args[0], e)) return out