aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-07-01 19:45:03 +0300
committerGitHub <noreply@github.com>2018-07-01 19:45:03 +0300
commitdc683218a4dbb099d0da1c46e4e7bfe4f19ad9ce (patch)
tree3e258e12386c37abed42e4c37abf4d926d8e7b9e
parent7b2a07bcf9d3fd00013b51896ff3fe6ea852f114 (diff)
downloadmeson-dc683218a4dbb099d0da1c46e4e7bfe4f19ad9ce.zip
meson-dc683218a4dbb099d0da1c46e4e7bfe4f19ad9ce.tar.gz
meson-dc683218a4dbb099d0da1c46e4e7bfe4f19ad9ce.tar.bz2
Proper error message for non-found exe in run_target. Closes #3818
-rw-r--r--mesonbuild/interpreter.py2
-rw-r--r--test cases/failing/81 unfound run/meson.build4
2 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 5a9cc22..2cf1752 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3087,6 +3087,8 @@ root and issuing %s.
if not isinstance(i, (str, build.BuildTarget, build.CustomTarget, dependencies.ExternalProgram, mesonlib.File)):
mlog.debug('Wrong type:', str(i))
raise InterpreterException('Invalid argument to run_target.')
+ if isinstance(i, dependencies.ExternalProgram) and not i.found():
+ raise InterpreterException('Tried to use non-existing executable {!r}'.format(i.name))
cleaned_args.append(i)
name = args[0]
if not isinstance(name, str):
diff --git a/test cases/failing/81 unfound run/meson.build b/test cases/failing/81 unfound run/meson.build
new file mode 100644
index 0000000..3f37e9a
--- /dev/null
+++ b/test cases/failing/81 unfound run/meson.build
@@ -0,0 +1,4 @@
+project('unfound runtarget')
+
+exe = find_program('nonexisting_prog', required : false)
+run_target('invoke_fail', command : [exe])