From b0976ab1ae17699374bd9e21e73fbcda871de8e9 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 24 Jun 2009 18:42:07 +0100 Subject: [PATCH] Fix win32/mingw bug running commands with command-template: needed to escape backslashes before calling shlex.split(). --- regression.py | 2 ++ wutils.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/regression.py b/regression.py index 4ec4fba85..65fe53fe5 100644 --- a/regression.py +++ b/regression.py @@ -142,6 +142,8 @@ class regression_test_task(Task.TaskBase): 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 diff --git a/wutils.py b/wutils.py index 9a6c9187c..56815931c 100644 --- a/wutils.py +++ b/wutils.py @@ -159,6 +159,7 @@ def get_run_program(program_string, command_template=None): 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 @@ def get_run_program(program_string, command_template=None): #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):