WAF: --run now runs the specified program from the directory where waf was invoked.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sun, 08 Jul 2007 12:24:22 +0100
changeset 919 a9c7effce441
parent 918 1ecec08ba4ba
child 920 f04132bd679b
WAF: --run now runs the specified program from the directory where waf was invoked.
wscript
--- a/wscript	Sat Jul 07 18:10:54 2007 +0100
+++ b/wscript	Sun Jul 08 12:24:22 2007 +0100
@@ -221,7 +221,13 @@
         Params.fatal("%s does not appear to be a program" % (program_name,))
 
     execvec = [program_node.abspath(env)] + argv[1:]
-    return _run_argv(execvec)
+
+    former_cwd = os.getcwd()
+    os.chdir(Params.g_cwd_launch)
+    try:
+        return _run_argv(execvec)
+    finally:
+        os.chdir(former_cwd)
 
 
 def run_shell():