Hello,
empty arguments are not quoted by subprocess.list2cmdline. Therefore nothing is concatenated with other arguments. To reproduce it:
test-empty.py
"""
import sys
print sys.argv
"""
then:
"""
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> p = subprocess.Popen(['python', 'test-empty.py', ''], stdout=subprocess.PIPE)
>>> p.communicate()
("['test-empty.py']\r\n", None)
"""
To solve it:
"""
--- a\subprocess.py 2007-01-12 21:38:57.734375000 +0100
+++ b\subprocess.py 2007-01-12 21:34:08.406250000 +0100
@@ -499,7 +499,7 @@
if result:
result.append(' ')
- needquote = (" " in arg) or ("\t" in arg)
+ needquote = (" " in arg) or ("\t" in arg) or not arg
if needquote:
result.append('"')
"""
Regard,
Patrick Mézard
|