mirror of
https://git.yoctoproject.org/poky
synced 2026-06-12 16:50:07 +00:00
wic: raise WicError in core modules
Replaced sys.exit with raising WicError in the core wic modules. (From OE-Core rev: 1b11437fb25ece5b3eede52344b071e875fa738f) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
3d47a212a6
commit
f5ae79da40
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user