-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use shlex.quote for quoting shell arguments #1470
Conversation
Thanks for starting this! This is sort of papering over a bigger design issue, which is the use of |
@davidism Yes, I can do that. I just have a couple questions about the intentions of some
|
Yes, I agree it seems overly complex to just check if it exists. Since there's no comments about why that was used, and simpler commands seem to accomplish the same thing, I don't mind replacing it. I don't want to copy the
The I opened #1476 for replacing |
335e294
to
e798f64
Compare
I'm going to merge this in to 7.1, but it should eventually be replaced with #1477. I added |
We are experiencing the same regression as @dufferzafar although in our case it is maybe a bit because we were abusing the liberty of the interface. For unit testing of interactive components of our CLI that require the user to make changes in a visual editor, we would actually set the I realize that our approach is a bit hacky: do you have an alternate idea on how to unit test interactive commands that go through an editor? |
Click 7.1.2 is available on PyPI. |
There are several points in the code in which filenames used as arguments in shell commands (executed with either
os.system()
orsubprocess.Popen(shell=True)
) are quoted by just enclosing them in double quotes. This will fail whenever the filenames happen to already contain double quotes. This patch fixes this behavior by quoting the filenames withshlex.quote()
instead (pipes.quote()
in Python 2).fixes #1026