Commit 20fdd068 authored by Gregory P. Smith's avatar Gregory P. Smith

Fix issue 1300: Quote command line arguments that contain a '|' character in

subprocess.list2cmdline (windows).
parent a8173283
......@@ -471,8 +471,8 @@ def list2cmdline(seq):
2) A string surrounded by double quotation marks is
interpreted as a single argument, regardless of white space
contained within. A quoted string can be embedded in an
argument.
or pipe characters contained within. A quoted string can be
embedded in an argument.
3) A double quotation mark preceded by a backslash is
interpreted as a literal double quotation mark.
......@@ -498,7 +498,7 @@ def list2cmdline(seq):
if result:
result.append(' ')
needquote = (" " in arg) or ("\t" in arg) or not arg
needquote = (" " in arg) or ("\t" in arg) or ("|" in arg) or not arg
if needquote:
result.append('"')
......
......@@ -434,6 +434,8 @@ class ProcessTestCase(unittest.TestCase):
'"a\\\\b\\ c" d e')
self.assertEqual(subprocess.list2cmdline(['ab', '']),
'ab ""')
self.assertEqual(subprocess.list2cmdline(['echo', 'foo|bar']),
'echo "foo|bar"')
def test_poll(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment