Open
Description
Hi, thanks as ever for CIDER - we live inside it and it's amazing. I'm digging deeper into shadow-cljs
and am getting hung up because my print output is getting lost in this one specific case...
Expected behavior
println
produces output in the repl
Actual behavior
I cannot find my println
output anywhere (:
Steps to reproduce the problem
When using shadow-cljs
without CIDER, I eventually see the "INSIDE"
printed:
$ npx create-cljs-project node-server-test
[snip...]
----
Done. Actual project initialization will follow soon.
----
$ cd node-server-test/
$ npx shadow-cljs node-repl
shadow-cljs - config: /home/harold/node-server-test/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
shadow-cljs - server version: 2.26.2 running at http://localhost:9630
shadow-cljs - nREPL server started on port 36159
shadow-cljs - #4 ready!
cljs.user=> (defn handler [req res] (println "INSIDE") (.write res "Hello!") (.end res))
#'cljs.user/handler
cljs.user=> (require '["http" :as http])
nil
cljs.user=> (def s (http/createServer handler))
#'cljs.user/s
cljs.user=> (.listen s 8000)
#object[Server [object Object]]
;; Then, in another terminal:
$ curl localhost:8000
Hello!
;; And this is seen in the terminal repl:
cljs.user=> INSIDE
When doing the same thing in CIDER:
(cider-jack-in-cljs)
shadow
node-repl
;; Connected to nREPL server - nrepl://localhost:42703
;; CIDER 1.9.0 (Barcelona), nREPL 1.0.0
;; Clojure 1.11.1, Java 11.0.21
;; Docs: (doc function-name)
;; (find-doc part-of-name)
;; Source: (source function-name)
;; Javadoc: (javadoc java-object-or-class)
;; Exit: <C-c C-q>
;; Results: Stored in vars *1, *2, *3, an exception in *e;
;; Startup: /usr/local/bin/npx shadow-cljs -d nrepl/nrepl:1.0.0 -d cider/cider-nrepl:0.41.0 -d cider/piggieback:0.5.3 server
;;
;; ClojureScript REPL type: shadow
;; ClojureScript REPL init form: (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/node-repl))
;;
To quit, type: :cljs/quit
[:selected :node-repl]
shadow.user>
cljs.user> (defn handler [req res] (println "INSIDE") (.write res "Hello!") (.end res))
#'cljs.user/handler
cljs.user> (require '["http" :as http])
nil
cljs.user> (def s (http/createServer handler))
#'cljs.user/s
cljs.user> (.listen s 8000)
#object[Server [object Object]]
;; And now in the other terminal curl works works again (:
;; but the "INSIDE" print output is never seen :|
cljs.user>
Environment & Version information
Emacs version
27.1
Operating system
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
JDK distribution
$ java --version
openjdk 11.0.21 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
Thanks in advance for your time and consideration, I am looking forward to developing this node app inside cider with shadow-cljs. 😄