Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
20fdd068
Commit
20fdd068
authored
Jan 19, 2008
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
parent
a8173283
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
Lib/subprocess.py
Lib/subprocess.py
+3
-3
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+2
-0
No files found.
Lib/subprocess.py
View file @
20fdd068
...
@@ -471,8 +471,8 @@ def list2cmdline(seq):
...
@@ -471,8 +471,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
contained within. A quoted string can be embedded in an
or pipe characters contained within. A quoted string can be
argument.
embedded in an
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.
...
@@ -498,7 +498,7 @@ def list2cmdline(seq):
...
@@ -498,7 +498,7 @@ def list2cmdline(seq):
if
result
:
if
result
:
result
.
append
(
' '
)
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
:
if
needquote
:
result
.
append
(
'"'
)
result
.
append
(
'"'
)
...
...
Lib/test/test_subprocess.py
View file @
20fdd068
...
@@ -434,6 +434,8 @@ class ProcessTestCase(unittest.TestCase):
...
@@ -434,6 +434,8 @@ class ProcessTestCase(unittest.TestCase):
'"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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment