Frage

For example I have following command to run my project:

java -cp "lib/*:src:resources" clojure.main -m etl-proxy.proxy.core

So I try to create comint buffer with following command:

(progn 
   (kill-all-local-variables)
   (erase-buffer)
   (comint-mode)
   (comint-exec (current-buffer) "etl-proxy" 
                "java" nil '("-cp" "\"lib/*:src:resources\"" "clojure.main" 
                            "-m" "etl-proxy.proxy.core")))

This will result into java classpath error. But when I change "lib/*:src:resources" key in properties list this work fine.

How I cat force string processing in comint mode without running shell in it?

War es hilfreich?

Lösung

I think what you call "string processing" is the processing performed by the usual shell. The better tool to do it (i.e. to do it following all the rules such as what needs to be quoted, what happens if a $(...) appears inside the "...", how to expand "foo"*"bar", etc...) is the shell.

If you know that the processing you need is much simpler than what the shell can do, you can try and use special-case code to avoid going through a shell. shell.el does that in a few places and uses shell--unquote-argument for that, so you can try using that function, as in:

(comint-exec (current-buffer) "etl-proxy" 
             "java" nil (mapcar #'shell--unquote-argument
                                '("-cp" "\"lib/*:src:resources\"" "clojure.main" 
                                  "-m" "etl-proxy.proxy.core"))))

but in your case, it's probably simpler to just use a shell:

(comint-exec (current-buffer) "etl-proxy" 
             "/bin/sh" nil '("-c" "java -cp \"lib/*:src:resources\" clojure.main -m etl-proxy.proxy.core"))
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top