Commit 6381de1b authored by Jean-Paul Calderone's avatar Jean-Paul Calderone

Merged revisions 82075 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82075 | jean-paul.calderone | 2010-06-18 16:00:17 -0400 (Fri, 18 Jun 2010) | 12 lines

  Revert r60115

  This revision introduced quoting for strings containing | based
  on a misunderstanding of the commonly used quoting rules used
  on Windows.

  | is interpreted by cmd.exe, not by the MS C runtime argv initializer.
  It only needs to be quoted if it is part of an argument passed through
  cmd.exe.

  See issue1300, issue7839, and issue8972.
........
parent 06c0f218
...@@ -500,8 +500,8 @@ def list2cmdline(seq): ...@@ -500,8 +500,8 @@ def list2cmdline(seq):
2) A string surrounded by double quotation marks is 2) A string surrounded by double quotation marks is
interpreted as a single argument, regardless of white space interpreted as a single argument, regardless of white space
or pipe characters contained within. A quoted string can be contained within. A quoted string can be embedded in an
embedded in an argument. argument.
3) A double quotation mark preceded by a backslash is 3) A double quotation mark preceded by a backslash is
interpreted as a literal double quotation mark. interpreted as a literal double quotation mark.
...@@ -529,7 +529,7 @@ def list2cmdline(seq): ...@@ -529,7 +529,7 @@ def list2cmdline(seq):
if result: if result:
result.append(' ') result.append(' ')
needquote = (" " in arg) or ("\t" in arg) or ("|" in arg) or not arg needquote = (" " in arg) or ("\t" in arg) or not arg
if needquote: if needquote:
result.append('"') result.append('"')
......
...@@ -478,8 +478,6 @@ class ProcessTestCase(BaseTestCase): ...@@ -478,8 +478,6 @@ class ProcessTestCase(BaseTestCase):
'"a\\\\b\\ c" d e') '"a\\\\b\\ c" d e')
self.assertEqual(subprocess.list2cmdline(['ab', '']), self.assertEqual(subprocess.list2cmdline(['ab', '']),
'ab ""') 'ab ""')
self.assertEqual(subprocess.list2cmdline(['echo', 'foo|bar']),
'echo "foo|bar"')
def test_poll(self): 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