Skip to content

Commit

Permalink
repl task needs to disable pumping *in*.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Oct 23, 2012
1 parent abb9e44 commit ecdc783
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
8 changes: 0 additions & 8 deletions doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,3 @@
which is undesirable. Since switching the default repositories to a
releases-only Clojars (which is still in development) would be a
breaking change, a series of previews is being released in the mean time.

**Q:** I don't have access to stdin inside my project.
**A:** This is a limitation of the JVM's process-handling methods;
none of them expose stdin correctly. This means that functions like
`read-line` will not work as expected in most contexts, though the
`repl` task necessarily includes a workaround. You can also use the
`trampoline` task to launch your project's JVM after Leiningen's has
exited rather than launching it as a subprocess.
5 changes: 4 additions & 1 deletion leiningen-core/src/leiningen/core/eval.clj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@

(def ^:dynamic *env* nil)

(def ^:dynamic *pump-in* true)

(defn- overridden-env
"Returns an overridden version of the current environment as an Array of
Strings of the form name=val, suitable for passing to Runtime#exec."
Expand All @@ -149,7 +151,8 @@
in (io/writer (.getOutputStream proc))]
(let [pump-out (doto (Thread. (bound-fn [] (pump out *out*))) .start)
pump-err (doto (Thread. (bound-fn [] (pump err *err*))) .start)
pump-in (doto (Thread. (bound-fn [] (pump *in* in))) .start)]
pump-in (Thread. (bound-fn [] (pump *in* in)))]
(when *pump-in* (.start pump-in))
(.join pump-out)
(.join pump-err))
(.waitFor proc))))
Expand Down
5 changes: 3 additions & 2 deletions src/leiningen/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ and port."
(.start
(Thread.
(bound-fn []
(start-server project (repl-host project) (repl-port project)
(-> @lein-repl-server deref :ss .getLocalPort)))))
(binding [eval/*pump-in* false]
(start-server project (repl-host project) (repl-port project)
(-> @lein-repl-server deref :ss .getLocalPort))))))
(when project @prep-blocker)
(if-let [repl-port (nrepl.ack/wait-for-ack (-> project
:repl-options
Expand Down

0 comments on commit ecdc783

Please sign in to comment.