Skip to content

Commit

Permalink
Merge pull request technomancy#1338 from jcrossley3/port-required
Browse files Browse the repository at this point in the history
Abort with a nicer message when neither port nor .nrepl-port is provided
  • Loading branch information
hypirion committed Oct 2, 2013
2 parents 9e04655 + 360fab0 commit a4a027c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/leiningen/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
(defn client-repl-port [project]
(let [port (repl-port project)]
(if (= port 0)
(slurp (io/file (:root project) ".nrepl-port"))
(try
(slurp (io/file (:root project) ".nrepl-port"))
(catch Exception _ (main/abort "Port is required")))
port)))

(defn connect-string [project opts]
Expand Down
5 changes: 4 additions & 1 deletion test/leiningen/test/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@
"7" "repl-host:7"
"myhost:9" "myhost:9"
"http://localhost:20" "http://localhost:20")
(is (= "127.0.0.1:4242" (connect-string lthelper/sample-project []))))
(is (= "127.0.0.1:4242" (connect-string lthelper/sample-project [])))
(is (re-find
#"Port is required"
(lthelper/abort-msg connect-string lthelper/with-resources-project []))))

(deftest test-options-for-reply
(is (= (lthelper/fix-path-delimiters "/home/user/.lein-repl-history")
Expand Down

0 comments on commit a4a027c

Please sign in to comment.