Skip to content
Permalink
Browse files

scripts: west: improve error message on missing cache

In the west flash/debug commands, if the user gives an invalid build
directory, they'll get a stack trace instead of a helpful error
message when the cache can't be built.

Fix that.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and MaureenHelm committed Jun 10, 2019
1 parent 00c41ea commit 8718d5c84b027d791745fa8c4ee58f8977699d5c
Showing with 4 additions and 1 deletion.
  1. +4 −1 scripts/west_commands/run_common.py
@@ -171,7 +171,10 @@ def do_run_common(command, args, runner_args, cached_runner_var):
# make sure it supports the command.

cache_file = path.join(build_dir, args.cmake_cache or cmake.DEFAULT_CACHE)
cache = cmake.CMakeCache(cache_file)
try:
cache = cmake.CMakeCache(cache_file)
except FileNotFoundError:
log.die('no CMake cache found (expected one at {})'.format(cache_file))
board = cache['CACHED_BOARD']
available = cache.get_list('ZEPHYR_RUNNERS')
if not available:

0 comments on commit 8718d5c

Please sign in to comment.
You can’t perform that action at this time.