Skip to content

Commit

Permalink
Merge pull request #95 from clj-commons/93-cider-nrepl-failure
Browse files Browse the repository at this point in the history
Use Namespace/find to see if nrepl is running, not require
  • Loading branch information
hlship committed Jul 20, 2023
2 parents 5f279e4 + 77a6871 commit 472f32e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/clj_commons/ansi.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
Reference: [ANSI Escape Codes @ Wikipedia](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR)."
(:require [clojure.string :as str]
[clj-commons.pretty-impl :refer [csi padding]]))
[clj-commons.pretty-impl :refer [csi padding]])
(:import (clojure.lang Namespace)))

(defn- is-ns-available? [sym]
(try
(require sym)
true
(catch Throwable _ false)))
(defn- is-ns-loaded?
[sym]
(some? (Namespace/find sym)))

(defn- to-boolean
[s]
Expand All @@ -36,7 +35,7 @@
(cond
(some? flag) (to-boolean flag)

(is-ns-available? 'nrepl.core)
(is-ns-loaded? 'nrepl.core)
true

:else
Expand Down

0 comments on commit 472f32e

Please sign in to comment.