Skip to content

Commit 26af743

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 3d0cabf commit 26af743

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
## Changed
1919

20+
- Make sure the clojure process can communicate over `stdio`.
21+
2022
# 0.42.182-alpha (2025-03-01 / 50cc172)
2123

2224
## Fixed

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)