Ticket #13173: admin_scripts_quoting.diff

File admin_scripts_quoting.diff, 854 bytes (added by Gabriel Hurley, 15 years ago)

Patch includes smarter quoting to account for spaces in executable path and Popen irregularities.

  • tests/regressiontests/admin_scripts/tests.py

     
    101101        os.environ[python_path_var_name] = os.pathsep.join(python_path)
    102102
    103103        # Build the command line
    104         cmd = '%s "%s"' % (sys.executable, script)
    105         cmd += ''.join([' %s' % arg for arg in args])
     104        executable = sys.executable
     105        arg_string = ' '.join(['%s' % arg for arg in args])
     106        if executable.count(" "):
     107            cmd = '""%s" "%s" %s"' % (executable, script, arg_string)
     108        else:
     109            cmd = '%s "%s" %s' % (executable, script, arg_string)
    106110
    107111        # Move to the test directory and run
    108112        os.chdir(test_dir)
Back to Top