Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Mon, 24 Nov 2008 17:49:33 +0000
changeset 3919 fd796ed5b166
parent 3918 3604c4e42fd1
child 3920 736b807ae8c0
child 3945 bbccb5d7b6ea
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
wscript
--- a/wscript	Mon Nov 24 15:28:42 2008 +0000
+++ b/wscript	Mon Nov 24 17:49:33 2008 +0000
@@ -354,13 +354,6 @@
 
 
 def build(bld):
-    
-    # When --run'ing a program, tell WAF to only build that program,
-    # nothing more; this greatly speeds up compilation when all you
-    # want to do is run a test program.
-    if Params.g_options.run and not Params.g_options.compile_targets:
-        Params.g_options.compile_targets = Params.g_options.run
-
     if Params.g_options.no_task_lines:
         import Runner
         def null_printout(s):
@@ -450,6 +443,20 @@
 
     bld.add_subdirs('bindings/python')
 
+    if Params.g_options.run:
+        # Check that the requested program name is valid
+        try:
+            wutils.find_program(Params.g_options.run, env)
+        except ValueError, ex:
+            Params.fatal(str(ex))
+        
+        # When --run'ing a program, tell WAF to only build that program,
+        # nothing more; this greatly speeds up compilation when all you
+        # want to do is run a test program.
+        if not Params.g_options.compile_targets:
+            Params.g_options.compile_targets = Params.g_options.run
+
+
 
 def get_command_template(*arguments):
     if Params.g_options.valgrind: