Of course cmd.exe is hardcoded; there are no other shells on Windows! (I'm purposely ignoring MinGW, Cygwin, command.com, etc.) If anything, auto-escaping will break scripts that are already designed to escape carets on Windows.
On Sat, Jun 14, 2014 at 2:54 PM, anatoly techtonik <techto...@gmail.com> wrote: > On Fri, Jun 13, 2014 at 2:55 AM, Ryan Gonzalez <rym...@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 that > on Windows Python already uses cmd.exe shell hardcoded in its sources. So > for crossplatform behavior on Windows, it should escape symbols on command > passed to cmd.exe that are special to this shell to avoid breaking Python > scripts. What you propose is a bad workaround, because it assumes that all > Python users who use subprocess to execute hg or git should possess apriori > knowledge about default subprocess behaviour with default shell on Windows > and implement workaround for that. > -- > anatoly t. > -- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com