[Python-Dev] subprocess shell=True on Windows doesn't escape ^ character

anatoly techtonik techtonik at gmail.com
Sat Jun 14 22:07:27 CEST 2014


On Thu, Jun 12, 2014 at 5:12 AM, Chris Angelico <rosuav at gmail.com> wrote:

> On Thu, Jun 12, 2014 at 12:07 PM, Chris Angelico <rosuav at gmail.com> wrote:
> > ISTM what you want is not shell=True, but a separate function that
> > follows the system policy for translating a command name into a
> > path-to-binary. That's something that, AFAIK, doesn't currently exist
> > in the Python 2 stdlib, but Python 3 has shutil.which(). If there's a
> > PyPI backport of that for Py2, you should be able to use that to
> > figure out the command name, and then avoid shell=False.
>
> Huh. Next time, Chris, search the web before you post. Via a
> StackOverflow post, learned about distutils.spawn.find_executable().
>

I remember I even wrote a patch for it, but I forgot about it already.
Still feels like a hack that is difficult to find and understand that you
need really it. In Rietveld case it won't work, because upload.py script
allows user to specify arbitrary diff command to send change for
review.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140614/388eab5e/attachment.html>


More information about the Python-Dev mailing list