Skip to content

Make sure the clojure process can communicate over stdio #16

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
```
Aliases: :dev, :home/cider, :home/zprint, :mine/local
```
- Make sure the clojure process can communicate over `stdio`.

# 0.42.182-alpha (2025-03-01 / 50cc172)

Expand Down
8 changes: 4 additions & 4 deletions src/lambdaisland/launchpad.clj
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,14 @@
((run-process opts) ctx))
([{:keys [cmd prefix working-dir
background? timeout-ms check-exit-code? env
color show-command?]
show-command?]
:or {working-dir "."
check-exit-code? true
show-command? true}}]
(fn [ctx]
(let [working-dir (io/file working-dir)
proc-builder (doto (ProcessBuilder. (map str cmd))
(.inheritIO)
(.directory working-dir))
_ (.putAll (.environment proc-builder) (or env (:env ctx)))
color (mod (hash (or prefix (first cmd))) 8)
Expand All @@ -539,9 +540,8 @@
(.waitFor process timeout-ms TimeUnit/MILLISECONDS)
(.waitFor process))]
(when (and check-exit-code? (not= 0 exit))
(do
(println (str prefix) "Exited with non-zero exit code: " exit)
(System/exit exit)))
(println prefix "Exited with non-zero exit code: " exit)
(System/exit exit))
ctx))))))

(defn start-clojure-process [{:keys [aliases nrepl-port] :as ctx}]
Expand Down