[New-bugs-announce] [issue34064] subprocess functions with shell=1 pass wrong command to win32 shell

Ryusei Yamaguchi report at bugs.python.org
Sat Jul 7 06:30:07 EDT 2018


New submission from Ryusei Yamaguchi <mandel59 at gmail.com>:

In some cases, functions defined in subprocess modules pass wrong command to win32 shell.

Python 3.8.0a0 (heads/master:4629c0d531, Jul  7 2018, 16:37:33) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_output('cmd /c echo hello', shell=1)
b'hello"\r\n'

The result is as same as the following command run with cmd.exe:
C:\> %COMSPEC% /c "cmd /c echo hello"
hello"

Specifying /s switch fixes the issue:
C:\> %COMSPEC% /s /c "cmd /c echo hello"
hello

----------
components: Library (Lib), Windows
messages: 321213
nosy: mandel59, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: subprocess functions with shell=1 pass wrong command to win32 shell
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34064>
_______________________________________


More information about the New-bugs-announce mailing list