From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 2/2] wic: _exec_cmd: produce error if exit code is not 0
Date: Tue, 10 Jan 2017 19:46:09 +0200 [thread overview]
Message-ID: <1484070369-26765-2-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <1484070369-26765-1-git-send-email-ed.bartosh@linux.intel.com>
Current code doesn't always show error output of the
external command and even ignores non-zero exit code.
Moved checking of exit code value to the lowest level
possible: to _exec_cmd. This should make wic to always
check exit code of the external command and issue
an error if it's not 0.
[YOCTO #10816]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/utils/oe/misc.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index fe188c9..fd71935 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -65,6 +65,10 @@ def _exec_cmd(cmd_and_args, as_shell=False, catch=3):
else:
ret, out = runner.runtool(args, catch)
out = out.strip()
+ if ret != 0:
+ msger.error("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
+ (cmd_and_args, ret, out))
+
msger.debug("_exec_cmd: output for %s (rc = %d): %s" % \
(cmd_and_args, ret, out))
@@ -79,10 +83,6 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3):
"""
ret, out = _exec_cmd(cmd_and_args, as_shell, catch)
- if ret != 0:
- msger.error("exec_cmd: %s returned '%s' instead of 0" % \
- (cmd_and_args, ret))
-
return out
def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
@@ -126,12 +126,6 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
msg += "Wic failed to find a recipe to build native %s. Please "\
"file a bug against wic.\n" % prog
msger.error(msg)
- if out:
- msger.debug('"%s" output: %s' % (args[0], out))
-
- if ret != 0:
- msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
- (cmd_and_args, ret))
return ret, out
--
2.1.4
prev parent reply other threads:[~2017-01-10 18:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 17:46 [PATCH 1/2] direct.py: fix getting image name Ed Bartosh
2017-01-10 17:46 ` Ed Bartosh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484070369-26765-2-git-send-email-ed.bartosh@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.