New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subprocess: Arguments to .bat scripts get interpreted by shell #55348
Comments
As a regression from Python 2.6, when running .bat scripts on Windows with f.ex. subprocess.call under Python 2.7.1, arguments get interpreted by the shell. This bit me in the way that I could no longer pass arguments containing the character '|' to .bat scripts, something that works fine under Python 2.6. To see the bug in action, run tst.py in the attached case.zip with Python 2.7.1. The case also demonstrates that the '|' character only gets interpreted when launching cmd scripts, not e.g. python.exe. |
This seem to have been discussed in bpo-8972: closing as a duplicate. |
Well, it's not really a duplicate, but rather invalid, since the 2.7 behavior is more correct than the 2.6 behavior. Not that it matters all that much what particular resolution is attached to a bug. Arve: It is unfortunate that the bug fix in bpo-8972 caused a regression for you, but at this point what is done is done. Also, for future reference, when attaching files to an issue please attach text files only. They are much easier to review. |
Would you mind defining why the 2.7 behaviour is correct in this particular There certainly can't be any universal definition in subprocess saying that I understand completely that list2cmdline should implement C library Arve On Mon, Feb 7, 2011 at 4:38 PM, R. David Murray <report@bugs.python.org>wrote:
|
The point is that subprocess (now!) is *not* interpreting the arguments when shell is false. It is passing them through to Windows. What windows does with them after that is out of the control of subprocess (and always has been). |
I wasn't saying that subprocess is interpreting the arguments, but that the My current conclusion is that there has been a hole in the subprocess design Arve On Mon, Feb 7, 2011 at 6:06 PM, R. David Murray <report@bugs.python.org>wrote:
|
As noted in bpo-8972, it's not clear what such a mode should actually do. If you have a concrete proposal you could make it, probably on the python-ideas mailing list. But I'm personally not in favor of it; I prefer maintaining as much API consistency between windows and linux as we reasonably can. |
The non-obvious thing with 8972 is what to do with an argument list when the I can actually see that exarkun suggests something along the same lines in Arve On Mon, Feb 7, 2011 at 7:19 PM, R. David Murray <report@bugs.python.org>wrote:
|
Yes, having a cmd.exe 'quote' function, parallel to the shutil 'quote' function, would be an excellent addition to the stdlib. You could open a feature request for that. |
I'll keep it in mind. On Mon, Feb 7, 2011 at 8:00 PM, R. David Murray <report@bugs.python.org>wrote:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: