empty command line arguments filtered out on windows
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from anton <None>:
If I run something like {{{getProcessOutput('some.exe', ('foo', '', 'bar'))}}} on windows, the empty command line argument is filtered out and the command line that is actually run is {{{'some.exe foo bar'}}} (two spaces between foo and bar).
This can be fixed by improving the argument quoting in twisted.python.win32.cmdLineQuote:
{{{
--- twisted/python/win32.py 2009-06-10 11:01:54.753700000 +0300
+++ twisted/python/win32.py.orig 2009-06-10 11:01:22.457700000 +0300
@@ -75,7 +75,7 @@
@return: a quoted string.
"""
- quote = ((" " in s) or ("\t" in s) or ('"' in s) or s == '') and '"' or ''
+ quote = ((" " in s) or ("\t" in s) or ('"' in s)) and '"' or ''
return quote + _cmdLineQuoteRe2.sub(r"\1\1", _cmdLineQuoteRe.sub(r'\1\1\\"', s)) + quote
def quoteArguments(arguments):
}}}
The above would lead to the example command line becoming {{{'some.exe foo "" bar'}}} and {{{""}}} would be correctly unqoted as an empty argument.
----------
Type : defect
Component: core
Keywords :
Priority : normal
Nosy :
----------
http://twistedmatrix.com/trac/ticket/3876