Skip to content

Commit ba7d5d4

Browse files
committed
Make sure the clojure process can communicate over stdio
Some use case requires to talk with the process via stdio (clojure mcp). Currently the process we start via ProcessBuild does not expose that. This patch solves that by calling `.inheritIO` (Java & and later) on it.
1 parent a614b7d commit ba7d5d4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
```
2828
Aliases: :dev, :home/cider, :home/zprint, :mine/local
2929
```
30+
- Make sure the clojure process can communicate over `stdio`.
3031

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

src/lambdaisland/launchpad.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,14 @@
514514
((run-process opts) ctx))
515515
([{:keys [cmd prefix working-dir
516516
background? timeout-ms check-exit-code? env
517-
color show-command?]
517+
show-command?]
518518
:or {working-dir "."
519519
check-exit-code? true
520520
show-command? true}}]
521521
(fn [ctx]
522522
(let [working-dir (io/file working-dir)
523523
proc-builder (doto (ProcessBuilder. (map str cmd))
524+
(.inheritIO)
524525
(.directory working-dir))
525526
_ (.putAll (.environment proc-builder) (or env (:env ctx)))
526527
color (mod (hash (or prefix (first cmd))) 8)
@@ -539,9 +540,8 @@
539540
(.waitFor process timeout-ms TimeUnit/MILLISECONDS)
540541
(.waitFor process))]
541542
(when (and check-exit-code? (not= 0 exit))
542-
(do
543-
(println (str prefix) "Exited with non-zero exit code: " exit)
544-
(System/exit exit)))
543+
(println prefix "Exited with non-zero exit code: " exit)
544+
(System/exit exit))
545545
ctx))))))
546546

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

0 commit comments

Comments
 (0)