Skip to content

Commit cff17e3

Browse files
committed
cli: Provide better error message behavior when prepare fails
1 parent 66b95f5 commit cff17e3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

cli/cloe_launch/__main__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,13 @@ def cli_prepare(
342342
engine.conan_options = list(conan_option)
343343
engine.conan_settings = list(conan_setting)
344344

345-
engine.prepare()
345+
try:
346+
engine.prepare()
347+
except ChildProcessError:
348+
# Most likely scenario:
349+
# 1. conan had an error and terminated with non-zero error
350+
# 2. error has already been logged
351+
sys.exit(1)
346352

347353

348354
# _________________________________________________________________________

cli/cloe_launch/utility.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def run_cmd(
2525
)
2626
if result.returncode != 0:
2727
logging.error(f"Error running: {' '.join(cmd)}")
28-
logging.error(result.stdout)
28+
if result.stdout is not None:
29+
logging.error(result.stdout)
2930
if must_succeed:
3031
raise ChildProcessError()
3132
return result

0 commit comments

Comments
 (0)