run-tests: quote PYTHON when spawning a subprocess
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 19 Sep 2018 20:45:57 -0400
changeset 39717 7f8b7a060584
parent 39716 4dca2e028f0a
child 39718 ac32685011a3
run-tests: quote PYTHON when spawning a subprocess Same reason as 5abc47d4ca6b. This covers running *.py tests, as well as inline python blocks. I didn't hit the path around line 3079, but it seems correct to quote.
tests/run-tests.py
--- a/tests/run-tests.py	Mon Sep 17 20:43:40 2018 -0400
+++ b/tests/run-tests.py	Wed Sep 19 20:45:57 2018 -0400
@@ -1213,7 +1213,7 @@
 
     def _run(self, env):
         py3kswitch = self._py3kwarnings and b' -3' or b''
-        cmd = b'%s%s "%s"' % (PYTHON, py3kswitch, self.path)
+        cmd = b'"%s"%s "%s"' % (PYTHON, py3kswitch, self.path)
         vlog("# Running", cmd)
         normalizenewlines = os.name == 'nt'
         result = self._runcommand(cmd, env,
@@ -1475,7 +1475,7 @@
                     # We've just entered a Python block. Add the header.
                     inpython = True
                     addsalt(prepos, False) # Make sure we report the exit code.
-                    script.append(b'%s -m heredoctest <<EOF\n' % PYTHON)
+                    script.append(b'"%s" -m heredoctest <<EOF\n' % PYTHON)
                 addsalt(n, True)
                 script.append(l[2:])
             elif l.startswith(b'  ... '): # python inlines
@@ -3078,7 +3078,7 @@
         if self._hgpath is not None:
             return self._hgpath
 
-        cmd = b'%s -c "import mercurial; print (mercurial.__path__[0])"'
+        cmd = b'"%s" -c "import mercurial; print (mercurial.__path__[0])"'
         cmd = cmd % PYTHON
         if PYTHON3:
             cmd = _strpath(cmd)