Gregory P. Smith <g...@krypto.org> added the comment:

Nathaniel's specific description of a problem is wrong.  A Path with embedded 
spaces is treated no different than one without by default.

Where things change, and what needs fixing, is when shell=True is passed. In 
that case a PathLike object should not be allowed as it will be turned into a 
flat string passed to the shell for parsing.

# I've created an executable bash script called "x/mybin -h" for this that just 
does: echo "hello from mybin $*"

>>> run("x/mybin -h", shell=True)
/bin/sh: 1: x/mybin: not found
CompletedProcess(args='x/mybin -h', returncode=127)
>>> run("x/mybin -h")
hello from mybin 
CompletedProcess(args='x/mybin -h', returncode=0)
>>> run(Path("x/mybin -h"), shell=True)
/bin/sh: 1: x/mybin: not found
CompletedProcess(args=PosixPath('x/mybin -h'), returncode=127)
>>> run([Path("x/mybin -h")], shell=True)
/bin/sh: 1: x/mybin: not found
CompletedProcess(args=[PosixPath('x/mybin -h')], returncode=127)
>>> run(Path("x/mybin -h"))
hello from mybin 
CompletedProcess(args=PosixPath('x/mybin -h'), returncode=0)
>>> run([Path("x/mybin -h")])
hello from mybin

----------
priority: release blocker -> deferred blocker

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31961>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to