Skip to content
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

Built-in REPL task doesn't close nREPL server when Boot pipeline is closed #554

Closed
Deraen opened this issue Dec 27, 2016 · 2 comments
Closed
Labels

Comments

@Deraen
Copy link
Contributor

Deraen commented Dec 27, 2016

To reproduce:

$ boot repl
=> (boot (comp (repl :server true :port 4567) (wait)))

In another terminal:

$ boot repl -c -p 4567

Once the pipeline is closed on the first terminal with C-c, the repl server should be stopped.

I think repl task should add a cleanup hook to close the nrepl server.

This also affect boot-cljs-repl.

Ping @vikeri

@Deraen
Copy link
Contributor Author

Deraen commented Dec 27, 2016

It would be easy to add cleanup hook for repl task, but currently cleanup-fns are global and closing one "boot process" will call cleanup fns for all other prcesses. In repl task case this means that even the main process would be closed.

REPL cleanup hook for future use.

diff --git a/boot/core/src/boot/task/built_in.clj b/boot/core/src/boot/task/built_in.clj
index 1cc5580..5cf8711 100644
--- a/boot/core/src/boot/task/built_in.clj
+++ b/boot/core/src/boot/task/built_in.clj
@@ -474,6 +474,8 @@
         deps     (remove pod/dependency-loaded? @repl/*default-dependencies*)
         repl-svr (delay (apply core/launch-nrepl (mapcat identity srv-opts)))
         repl-cli (delay (pod/with-call-worker (boot.repl-client/client ~cli-opts)))]
+    (when (or server (not client))
+      (core/cleanup (@repl-svr)))
     (comp (core/with-pass-thru [fs]
             (when (or server (not client)) @repl-svr))
           (core/with-post-wrap [_]

@burn2delete
Copy link
Contributor

Closing as we have a new repl task since issue was opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants