Skip to content

Commit

Permalink
Fix repl in interactive task.
Browse files Browse the repository at this point in the history
Still a bit of a mystery why we need an extra keypress after exiting
the repl.
  • Loading branch information
technomancy committed Mar 4, 2011
1 parent e56e201 commit ee9932a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/leiningen/interactive.clj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
(let [[task-name & args] (string/split input #"\s")]
;; TODO: don't start a second repl server for repl task
(try (apply-task task-name project args not-found)
;; TODO: not sure why, but repl seems to put an extra EOF on *in*
(when (= "repl" task-name)
(.read *in*))
(catch Exception e
(println (.getMessage e))))
(print-prompt)
Expand All @@ -67,6 +70,6 @@
(let [connect #(poll-repl-connection port 0 vector)]
(binding [eval-in-project (partial eval-in-repl connect)
*exit-after-tests* false
exit (fn [_] (println "\n"))]
exit (fn exit [& _] (prn))]
(task-repl project)))
(exit)))
3 changes: 1 addition & 2 deletions src/leiningen/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
(.start (Thread. #(copy-out-loop reader)))
(loop [reader reader, writer writer]
(let [input (read-line)]
;; TODO: ^D is not being honored
(when (and input (not= "" input))
(.write writer (str input "\n"))
(.flush writer)
Expand Down Expand Up @@ -137,4 +136,4 @@ Running outside a project directory will start a standalone repl session."
(clojure.main/with-bindings (println (eval server-form)))
(eval-in-project project server-form)))
(poll-repl-connection port retries repl-client)
0)))
(exit))))

0 comments on commit ee9932a

Please sign in to comment.