[Kimchi-devel] [PATCH] Return info from run_command on exception.

Christy Perez christy at linux.vnet.ibm.com
Thu May 1 19:29:52 UTC 2014


    As a follow-up from the discussion here:
    http://lists.ovirt.org/pipermail/kimchi-devel/2014-April/004600.html
    run_command needs to be updated to return some indication
    to the caller that a command did not complete. Currently,
    if there is an exception (e.g. the command does not exist),
    None is returned for the output, the error output, and
    the return code.

    msg is already created, but only printed to the log/console,
    so return that as the error message. Return -1 for the rc, which
    could be, depending on the command passed, an ignorable error
    code. Having some indication of a problem is better than None,
    though.

Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
 src/kimchi/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index a30dcfe..97adbf8 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -199,7 +199,7 @@ def run_command(cmd, timeout=None):
         if proc:
             return out, error, proc.returncode
         else:
-            return None, None, None
+            return None, msg, -1
     finally:
         if timer and not timeout_flag[0]:
             timer.cancel()
-- 
1.9.0




More information about the Kimchi-devel mailing list