[issue25815] Improper subprocess output of arguments with braces in them on windows

Александр Бондарев report at bugs.python.org
Fri Jun 15 04:33:14 EDT 2018


Александр Бондарев <alexander.i.bondarev at gmail.com> added the comment:

Can you please re-open this bug?
I'm not agree that this a correct behavior.
Usually we are using subprocess.check_output([..]) version to not aware about argument escaping and it works good for Linux.

In example:
> subprocess.check_output(['echo', "'hello'"])
"'hello'"

But:
> subprocess.check_output("echo 'hello'", shell=True)
'hello'

I'm expecting same behavior on Windows system, but:
> subprocess.check_output(['echo', "'hello'"])
'hello'
> subprocess.check_output("echo 'hello'", shell=True)
'hello'

and 
> subprocess.check_output(['echo', "'@{u}'"])
'@{u}'
> subprocess.check_output(['echo', "@{u}"])
'@u'

and it even more confusing:

> subprocess.check_output(['echo', " @{u}"])
' @{u}'

because if it detects some spaces in argument then it tries to quote this and it is correct behavior, but it should also care about other kind of characters to escape.

We definitely should bring more love for Windows!

----------
nosy: +Александр Бондарев

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


More information about the Python-bugs-list mailing list