Message311733
| Author |
gregory.p.smith |
| Recipients |
Phaqui, Roy Williams, gregory.p.smith, ned.deily, njs, serhiy.storchaka |
| Date |
2018年02月06日.16:52:23 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1517935943.74.0.467229070634.issue31961@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|