From: Jack Jansen Date: Mon, 24 Feb 2003 15:26:39 +0000 (+0000) Subject: sys.executable can contain spaces, cater for this when passing it to X-Git-Tag: v2.3c1~1702 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c44c0477bf1e6e00c15f6d316e293e56d057e40;p=thirdparty%2FPython%2Fcpython.git sys.executable can contain spaces, cater for this when passing it to os.popen(). Fixes #692222. --- diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py index 324b76e4cf78..1d120dfe2ca9 100644 --- a/Lib/test/test_atexit.py +++ b/Lib/test/test_atexit.py @@ -27,7 +27,7 @@ f = file(fname, "w") f.write(input) f.close() -p = popen("%s %s" % (executable, fname)) +p = popen('"%s" %s' % (executable, fname)) output = p.read() p.close() vereq(output, """\ @@ -55,7 +55,7 @@ f = file(fname, "w") f.write(input) f.close() -p = popen("%s %s" % (executable, fname)) +p = popen('"%s" %s' % (executable, fname)) output = p.read() p.close() vereq(output, """\ diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index 9111ec5e494d..7a0ef9be0720 100644 --- a/Lib/test/test_popen.py +++ b/Lib/test/test_popen.py @@ -15,7 +15,7 @@ from os import popen # This results in Python being spawned and printing the sys.argv list. # We can then eval() the result of this, and see what each argv was. def _do_test_commandline(cmdline, expected): - cmd = '%s -c "import sys;print sys.argv" %s' % (sys.executable, cmdline) + cmd = '"%s" -c "import sys;print sys.argv" %s' % (sys.executable, cmdline) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] if got != expected: