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

Implement stop-prepl #6

Closed
rafaeldelboni opened this issue Nov 3, 2019 · 1 comment
Closed

Implement stop-prepl #6

rafaeldelboni opened this issue Nov 3, 2019 · 1 comment

Comments

@rafaeldelboni
Copy link
Sponsor

Sometimes I need to restart my dev setup and I want to be sure I don't have dangling opened prepl connections, I currently use (clojure.core.server/stop-server) to stop prepl since it uses server/start-server, but would be a nice touch to have an "official way" to stop a prepl.

Sample code:

(ns user
  (:require
    [app.server :as server]
    [clojure.tools.namespace.repl :as tools-ns :refer [set-refresh-dirs refresh]]
    [propel.core :as propel]))

;; Ensure we only refresh the source we care about. This is important
;; because `resources` is on our classpath and we don't want to
;; accidentally pull source from there when cljs builds cache files there.
(set-refresh-dirs "src/dev" "src/main")

(defn start []
  (server/start)
  (propel/start-prepl! {:port-file? true}))

(defn restart
  "Stop the server, reload all source code, then restart the server.

  See documentation of tools.namespace.repl for more information."
  []
  (server/stop)
  (clojure.core.server/stop-server)
  (refresh :after 'user/start))
@Olical
Copy link
Owner

Olical commented Nov 5, 2019 via email

@Olical Olical closed this as completed in 30fd930 Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants