Skip to content

Commit a037828

Browse files
committed
nrepl: don't allow (dirac! :join) from within dirac nrepl session
1 parent cea87f0 commit a037828

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/nrepl/dirac/nrepl/controls.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
(defn ^:dynamic session-disjoined-msg []
133133
(str "Your session was disjoined from Dirac. Now you are back in normal Clojure session."))
134134

135-
(defn ^:dynamic cannot-match-dirac-session-msg []
135+
(defn ^:dynamic cannot-join-dirac-session-msg []
136136
(str "Your session is a Dirac session. This type of session cannot join any other session."))
137137

138138
(defn ^:dynamic cannot-match-clojure-session-msg []
@@ -222,6 +222,7 @@
222222
(defmethod dirac! :join [_ & [matcher]]
223223
(let [session (sessions/get-current-session)]
224224
(cond
225+
(sessions/dirac-session? session) (error-println (cannot-join-dirac-session-msg))
225226
(nil? matcher) (announce-join! (sessions/join-session-with-most-recent-matcher! session))
226227
(number? matcher) (announce-join! (sessions/join-session-with-number-matcher! session matcher))
227228
(string? matcher) (announce-join! (sessions/join-session-with-substr-matcher! session matcher))
@@ -246,7 +247,7 @@
246247
(defmethod dirac! :match [_ & _]
247248
(let [session (sessions/get-current-session)]
248249
(cond
249-
(sessions/dirac-session? session) (error-println (cannot-match-dirac-session-msg))
250+
(sessions/dirac-session? session) (error-println (cannot-join-dirac-session-msg))
250251
(not (sessions/joined-session? session)) (error-println (cannot-match-clojure-session-msg))
251252
:else (let [description (sessions/get-target-session-info session)
252253
tags (sessions/list-matching-sessions-tags session)]

0 commit comments

Comments
 (0)