Fix win32/mingw bug running commands with command-template: needed to escape backslashes before calling shlex.split().
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 24 Jun 2009 18:42:07 +0100
changeset 4584 7f4ee7f84b19
parent 4583 384117906219
child 4585 a720292fcd24
Fix win32/mingw bug running commands with command-template: needed to escape backslashes before calling shlex.split().
regression.py
wutils.py
--- a/regression.py	Wed Jun 24 16:12:09 2009 +0100
+++ b/regression.py	Wed Jun 24 18:42:07 2009 +0100
@@ -142,6 +142,8 @@
                     raise
             os.makedirs(trace_output_path)
             # run it
+            #print "self.run_reference_test:(%r, %r, %r, %r, %r)" \
+            #    % (reference_traces_path, trace_output_path, program, arguments, is_pyscript)
             result = self.run_reference_test(reference_traces_path, trace_output_path, program, arguments, is_pyscript)
             if result == 0:
                 print "PASS " + self.test_name
--- a/wutils.py	Wed Jun 24 16:12:09 2009 +0100
+++ b/wutils.py	Wed Jun 24 18:42:07 2009 +0100
@@ -159,6 +159,7 @@
 
     if command_template in (None, '%s'):
         argv = shlex.split(program_string)
+        #print "%r ==shlex.split==> %r" % (program_string, argv)
         program_name = argv[0]
 
         try:
@@ -188,7 +189,9 @@
         #except AttributeError:
         #    raise Utils.WafError("%s does not appear to be a program" % (program_name,))
 
-        execvec = shlex.split(command_template % (program_node.abspath(env),))
+        tmpl = command_template % (program_node.abspath(env),)
+        execvec = shlex.split(tmpl.replace('\\', '\\\\'))
+        #print "%r ==shlex.split==> %r" % (command_template % (program_node.abspath(env),), execvec)
     return program_name, execvec
 
 def run_program(program_string, env, command_template=None, cwd=None):