Fork me on GitHub

Hi guys! How can I rewrite this function with spawn instead of exec? I tried but got ENOENT errors

(defui build-configuration [this]
  [:button {:type "button"
            :style {:margin-left 15}}
  :click #(do
            (when (:builder @state)
              (kill-process (:builder @state)))
            (let [builder (.exec child-process (str "cd " (:path @this)
                                                    (if (= (:build @this) "dev")
                                                      (str (if (= (:platform @this) "android")
                                                             " && adb reverse tcp:8081 tcp:8081 && adb reverse tcp:3449 tcp:3449"
                                                           " && re-natal use-" (:platform @this) "-device " (:device @this)
                                                           " && re-natal use-figwheel && lein figwheel " (:platform @this))
                                                      " && lein prod-build")))]
              (-> (.-stdout builder)
                  (.on "data" (fn[data]
                                (println data))))
              (-> (.-stderr builder)
                  (.on "data" (fn[data]
                                (println data))))
              (swap! state assoc :builder builder))))


One difference between exec and spawn is whether the process executes in a shell by default. In node it seems, exec defaults to running the command via bash, but spawn defaults to no shell. That could be a problem; for example your command runs multiple programs in series via &&, which is a shell construct.


Hi friends, I'm having trouble getting React to play nicely in figwheel with the latest version of clojurescript I'm trying to use the new functionality described in Here's what I've done so far: + Checked out the latest version of Clojureuscript + Run script/build + BUILD SUCCESS for 1.9.820 + lein new figwheel example + Edit project.clj with the following: - Update org.clojure/clojurescript "1.9.820" - Update lein-figwheel "0.5.11" (also sidecar to match) - Update lein-cljsbuild "1.1.6" - Update the cljsbuild compiler options to include :npm-deps {:react "15.6.1" :react-dom "15.6.1"} + Change the default core.cljs to match the simple example in the news post above + Start a REPL (so VIM can connect to it) + lein figwheel in another shell The page renders the default Figwheel template and gives me no CLJS errors, but React spits out a ton in the web console: Uncaught ReferenceError: process is not defined Is there some step that I've missed in order to get NPM deps to magically compile?


That sounds like figwheel or cljsbuild is not using the latest version of ClojureScript (`1.9.820`) . Try using excluding the ClojureScript dependecies.


Like so [figwheel "0.5.11" :exclusions [org.clojure/clojurescript]]


I've got the following now: [lein-figwheel "0.5.11" :exclusions [org.clojure/clojurescript]] [lein-cljsbuild "1.1.6" :exclusions [org.clojure/clojure org.clojure/clojurescript]] seems to compile, but I get the same error


Even after running (clean-builds)


(Really appreciate your help btw; thanks!)


Oh wait you're running this in the browser right?


Yes sir, trying to view it through the default figwheel URL: http://localhost:3449/


i have :optimizations :none though; could that have something to do with it?


You have to run the example in node since the react.dom/server is server side rendering


what if i change it to react-dom instead?


That would might work. I'd try compiling the example exactly how it's shown in the blog post first


Looks like I get errors in node because Figwheel is injecting some stuff under the assumption that the document variable exists. Thanks for the help!


You're welcome, I'd file an issue in the figwheel project and setup a sample repo showing the behavoir


That's a great idea, thanks!


FYI: I got it working with node by specifying :target :nodejs in the cljsbuild options (and then running it with node)


Still need to figure out the whole web target business!