-
Notifications
You must be signed in to change notification settings - Fork 260
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
Test commands do not need quote escapes on Windows #416
Test commands do not need quote escapes on Windows #416
Conversation
Thank you for the contribution! You do not need I am confused why
Apparently,
There's |
The error is
with the patch from this PR it works. But I do not fully understand. I guess you will need to have access to a Windows machine to reproduce.
I added the appropriate test cases
I tried that with (let ((default-directory working-directory)
(quote-fun
(cond ((eq system-type 'windows-nt) #'identity)
(t #'shell-quote-argument)))) and with this all 4 tests in
|
What does
No need to, just test the case where it is "not windows-nt" to cover that branch. Your solution is fine. (If one wanted to, one could use
Do not quote the argument to (let ((quote-fun (if (eq system-type 'windows-nt)
#'identity
#'shell-quote-argument)))
(mapconcat quote-fun
'("foo" "bar" "baz")
" ")) |
bd9445e
to
33ff82d
Compare
33ff82d
to
75d16a4
Compare
75d16a4
to
b5c6d88
Compare
Ok, "just" covering both branches makes more sense than testing for all values.
True, my bad.
This gives
In a Command Window,
works (and so does
fails (and so does
similar to the one I initially got from Emacs
which looks suspicious judging from the above error message. I tested with the To sum up, the |
Thank you for looking into this! Could you report the bug with Anaconda? Shell escape mechanisms with CMD.EXE seem to be even more tricky than with /bin/sh :-| |
I updated to latest
works and
fails, but on the other hand (on CMD.EXE)
works now. This behaviour for Windows is mentioned in the official Emacs documentation[1]. If I read it correctly, I would assume that How about only escaping the The cause of this is still foggy and I think lies somewhere in the way this [1] http://www.gnu.org/software/emacs/manual/html_node/elisp/Shell-Arguments.html |
If the command includes a space (e.g. a full path with directories that contain spaces), it needs to be escaped under UNIX. (The correct solution here would be for |
With d140d8c one gets the space-escaping for a path with spaces, the old "unix" test passes. Am I missing something? |
How? |
The change is that in Please correct me if I am wrong - and thanks for your patience with an elisp rookie. |
Ah. That would require documenting, then, for future test commands (and poses the question why the test commands have to shell-quote the commands and not the arguments). You are right, though, this is indeed a possible work-around for this problem. Maybe we can fix the original problem, though. Deep down at the bottom, |
and it fails exactly as from
OTOH,
works (where |
Aha! That sounds like a bug in cmdproxy.exe. Would you report this, or should I? |
A last thing I wanted to test was whether
If you have an idea on how to formulate the bug report and reproduce, please go ahead :) |
I'd simply have reported that
This means (Not having windows makes it tricky for me to report this.) |
I am still wondering why
works regarding parsing... I really suspect |
The error you provided does not look like py.test is executed at all. Maybe the dot confuses cmdproxy.exe? If you rename ls.exe to some.ls.exe, does that work? :-) |
:-) Nice one. Ok will go ahead and report. Update:
works. I think that interactive CMD.EXE appends an |
I just noticed that github does not show PRs in the issue list when I check for the latest release. Great. Sorry for neglecting this for so long. I suspect this does not require merging, right? It's a bug in Emacs? Do you have a link to the upstream bug report? |
366a2cc
to
b7629b4
Compare
I neglected it for this long as well :) |
… ah, the supportive and helpful tone of emacs core development, it catches me off-guard every time :-D In case it helps: (defun compile-quoted (command &rest args)
"Run `compile' with COMMAND and ARGS quoted.
Useful if you can not be sure if there are special characters in
the command or arguments, like `start-process' allows."
(mapconcat #'shell-quote-argument
(cons command args)
" "))
(compile-quoted "write" "d:/asdf.txt")
(compile-quoted "write.test" "d:/asdf.txt") Thanks for passing this on upstream. |
Thanks for the use case sketch, I adapted it and put it up on the bug report. |
FYI, this has been resolved upstream :) |
Thank you! |
Another one for Windows compatibility. In essence, on Windows we do not need to escape quotes in the test run command. Test commands started from elpy will fail.
My approach was to
let
bind the correct function depending on OS and leave the mapping in. For Windows theidentity
function is mapped.The Travis CI results show that this does not work on Emacs version 24.3. Any ideas why it is just failing for that version?
Also, I was trying to add a test for this, but found no
test-quote-escape-in-test-run
or similar in the test suite. Also, I do not quite know how I would go about to test this function. Should we refactor the quote escape mapping to a separate function that just returns the test command string (so we can test it separately)?