Movatterモバイル変換


[0]ホーム

URL:


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

anatoly techtoniktechtonik at gmail.com
Sat Jun 14 21:54:01 CEST 2014


On Fri, Jun 13, 2014 at 2:55 AM, Ryan Gonzalez <rymg19 at gmail.com> wrote:> SHELLS ARE NOT CROSS-PLATFORM!!!! Seriously, there are going to be> differences. If you really must:>> escape = lambda s: s.replace('^', '^^') if os.name == 'nt' else s>It is not about generic shell problem, it is about specific behavior thaton Windows Python already uses cmd.exe shell hardcoded in its sources. Sofor crossplatform behavior on Windows, it should escape symbols on commandpassed to cmd.exe that are special to this shell to avoid breaking Pythonscripts. What you propose is a bad workaround, because it assumes that allPython users who use subprocess to execute hg or git should possess aprioriknowledge about default subprocess behaviour with default shell on Windowsand implement workaround for that.-- anatoly t.-------------- next part --------------An HTML attachment was scrubbed...URL: <http://mail.python.org/pipermail/python-dev/attachments/20140614/9f23e89d/attachment.html>


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp