Hi Max,

If you can do this at compile time, you could embed this logic in a macro, 
where Java capabilities are available.

Otherwise, you’d need to rely on facilities provided in your JavaScript 
environment for launching executables, and invoke those facilities using 
JavaScript interop. (For example, if your JavaScript runs in Node, you could 
use Node’s facilities.)

- Mike

> On Feb 21, 2017, at 5:14 AM, Max Muranov <[email protected]> wrote:
> 
> Trying to launch shell from settings of Light Table IDE. 
> 
> ----------
> (defn get-folder [path]
>  (reduce #(str %1 "/" %2) (butlast (.split path "\\"))))
> 
> (require '(clojure.java shell))
> 
> (defn exec-shell [file & commands]
>  (println (:out (clojure.java.shell/sh "cmd" "/c" (str "cd " (get-folder 
> file)) (reduce #(str %1 " & " %2) "" commands)))))
> 
> (cmd/command {:command :user.say-hello
>              :desc "User: Lein Deps"
>              :exec (fn []
>                      (let [ed (lt.objs.editor.pool/last-active)]
>                        (exec-shell (-> @ed :info :path) "echo 1")))})
> ----------
> 
> But it seems that I can't use java or clojure libs here. How can I execute a 
> command with clojurescript?
> 
> Maybe there's a way to launch cmd.exe via full path?
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to