<div dir="ltr">SHELLS ARE NOT CROSS-PLATFORM!!!! Seriously, there are going to be differences. If you really must:<div><br></div><div>escape = lambda s: s.replace('^', '^^') if <a href="http://os.name">os.name</a> == 'nt' else s</div>
<div><br></div><div>Viola.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 5:53 PM, anatoly techtonik <span dir="ltr"><<a href="mailto:techtonik@gmail.com" target="_blank">techtonik@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Thu, Jun 12, 2014 at 1:30 AM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On Thu, Jun 12, 2014 at 7:58 AM, Ryan <<a href="mailto:rymg19@gmail.com" target="_blank">rymg19@gmail.com</a>> wrote:<br>
> In all seriousness, to me this is obvious. When you pass a command to the<br>
> shell, naturally, certain details are shell-specific.<br></div></blockquote><div><br></div></div><div>On Windows cmd.exe is used by default:</div><div><a href="http://hg.python.org/cpython/file/38a325c84564/Lib/subprocess.py#l1108" target="_blank">http://hg.python.org/cpython/file/38a325c84564/Lib/subprocess.py#l1108</a><br>
</div><div>so it makes sense to make default behavior cross-platform.</div><div class=""><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>
> -10000. Bad idea. Very bad idea. If you want the ^ to be escaped, do it<br>
> yourself. Or better yet, don't pass shell=True.<br>
<br>
</div>Definitely the latter. Why pass shell=True when executing a single<br>
command? I don't get it.<br></blockquote><div><br></div></div><div>This is a complete use case using Rietveld upload script:</div><div><a href="http://techtonik.rainforce.org/2013/07/code-review-with-rietveld-and-mercurial.html" target="_blank">http://techtonik.rainforce.org/2013/07/code-review-with-rietveld-and-mercurial.html</a><br>
</div><div><br></div><div>I am interested to know how to modify upload script without kludges:</div><div><a href="https://code.google.com/p/rietveld/source/browse/upload.py#1056" target="_blank">https://code.google.com/p/rietveld/source/browse/upload.py#1056</a><br>
</div><div>I expect many people are facing with the same problem trying to wrap</div><div>Git and HG with Python scripts.</div></div><span class="HOEnZb"><font color="#888888">-- <br>anatoly t.
</font></span></div></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Ryan<div><div>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."</div>
</div><div><br></div></div>
</div>