mirror of
https://github.com/python/cpython.git
synced 2025-11-27 05:44:16 +00:00
sys.executable can contain spaces, cater for this when passing it to
os.popen(). Fixes #692222.
This commit is contained in:
parent
9ce623fce5
commit
0c44c0477b
2 changed files with 3 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ f = file(fname, "w")
|
||||||
f.write(input)
|
f.write(input)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
p = popen("%s %s" % (executable, fname))
|
p = popen('"%s" %s' % (executable, fname))
|
||||||
output = p.read()
|
output = p.read()
|
||||||
p.close()
|
p.close()
|
||||||
vereq(output, """\
|
vereq(output, """\
|
||||||
|
|
@ -55,7 +55,7 @@ f = file(fname, "w")
|
||||||
f.write(input)
|
f.write(input)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
p = popen("%s %s" % (executable, fname))
|
p = popen('"%s" %s' % (executable, fname))
|
||||||
output = p.read()
|
output = p.read()
|
||||||
p.close()
|
p.close()
|
||||||
vereq(output, """\
|
vereq(output, """\
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from os import popen
|
||||||
# This results in Python being spawned and printing the sys.argv list.
|
# 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.
|
# We can then eval() the result of this, and see what each argv was.
|
||||||
def _do_test_commandline(cmdline, expected):
|
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()
|
data = popen(cmd).read()
|
||||||
got = eval(data)[1:] # strip off argv[0]
|
got = eval(data)[1:] # strip off argv[0]
|
||||||
if got != expected:
|
if got != expected:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue