]> granicus.if.org Git - python/commitdiff
Patch #813200: Quote executable path on Windows. Fixes #811082.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 23 Oct 2003 15:55:28 +0000 (15:55 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 23 Oct 2003 15:55:28 +0000 (15:55 +0000)
Backported to 2.3.

Lib/test/test_tempfile.py

index d88d50f6176f5d59242da8779cceade948ca7339..d014ee83acf0f24ca8b6ff2d9523ce55dce0202b 100644 (file)
@@ -293,8 +293,16 @@ class test__mkstemp_inner(TC):
         tester = os.path.join(os.path.dirname(os.path.abspath(me)),
                               "tf_inherit_check.py")
 
-        retval = os.spawnl(os.P_WAIT, sys.executable,
-                           sys.executable, tester, v, fd)
+        # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted,
+        # but an arg with embedded spaces should be decorated with double
+        # quotes on each end
+        if sys.platform in ('win32'):
+            decorated = '"%s"' % sys.executable
+            tester = '"%s"' % tester
+        else:
+            decorated = sys.executable
+
+        retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd)
         self.failIf(retval < 0,
                     "child process caught fatal signal %d" % -retval)
         self.failIf(retval > 0, "child process reports failure")