summaryrefslogtreecommitdiff
path: root/scripts/lib/wic/utils
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-14 22:21:38 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-04 10:42:30 +0000
commit1b11437fb25ece5b3eede52344b071e875fa738f (patch)
tree032865c5c123d757a34e24693fe4743bcd2e18f5 /scripts/lib/wic/utils
parentb7c19f1ee8b850806c73ccd6f99c42d94a725fc9 (diff)
downloadopenembedded-core-1b11437fb25ece5b3eede52344b071e875fa738f.tar.gz
openembedded-core-1b11437fb25ece5b3eede52344b071e875fa738f.tar.bz2
openembedded-core-1b11437fb25ece5b3eede52344b071e875fa738f.zip
wic: raise WicError in core modules
Replaced sys.exit with raising WicError in the core wic modules. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts/lib/wic/utils')
-rw-r--r--scripts/lib/wic/utils/misc.py6
-rw-r--r--scripts/lib/wic/utils/runner.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py
index b7b835afbb..94fdab2669 100644
--- a/scripts/lib/wic/utils/misc.py
+++ b/scripts/lib/wic/utils/misc.py
@@ -33,6 +33,7 @@ import re
from collections import defaultdict
from distutils import spawn
+from wic.errors import WicError
from wic.utils import runner
logger = logging.getLogger('wic')
@@ -74,9 +75,8 @@ def _exec_cmd(cmd_and_args, as_shell=False, catch=3):
ret, out = runner.runtool(args, catch)
out = out.strip()
if ret != 0:
- logger.error("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
- (cmd_and_args, ret, out))
- sys.exit(1)
+ raise WicError("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
+ (cmd_and_args, ret, out))
logger.debug("_exec_cmd: output for %s (rc = %d): %s",
cmd_and_args, ret, out)
diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py
index d27dcc7afd..5ede1929a3 100644
--- a/scripts/lib/wic/utils/runner.py
+++ b/scripts/lib/wic/utils/runner.py
@@ -18,7 +18,8 @@
import logging
import os
import subprocess
-import sys
+
+from wic.errors import WicError
logger = logging.getLogger('wic')
@@ -72,8 +73,7 @@ def runtool(cmdln_or_args, catch=1):
except OSError as err:
if err.errno == 2:
# [Errno 2] No such file or directory
- logger.error('Cannot run command: %s, lost dependency?', cmd)
- sys.exit(1)
+ raise WicError('Cannot run command: %s, lost dependency?' % cmd)
else:
raise # relay
finally: