Exit Leiningen's JVM whenever project's process has exited. Fixes #324.

This commit is contained in:
Phil Hagelberg 2011-11-13 10:31:56 -08:00
parent f3e2518730
commit 7c1cb81786
2 changed files with 24 additions and 29 deletions

View file

@ -84,20 +84,22 @@
(defn copy-out-loop [reader] (defn copy-out-loop [reader]
(let [buffer (make-array Character/TYPE 1000)] (let [buffer (make-array Character/TYPE 1000)]
(loop [] (loop [length (.read reader buffer)]
(.write *out* buffer 0 (.read reader buffer)) (when-not (neg? length)
(flush) (.write *out* buffer 0 length)
(Thread/sleep 100) (flush)
(recur)))) (Thread/sleep 100)
(recur (.read reader buffer))))))
(defn repl-client [reader writer & [socket]] (defn repl-client [reader writer & [socket]]
(.start (Thread. #(copy-out-loop reader))) (.start (Thread. #(do (copy-out-loop reader)
(loop [reader reader, writer writer] (exit 0))))
(loop []
(let [input (read-line)] (let [input (read-line)]
(when (and input (not= "" input)) (when (and input (not= "" input) (not (.isClosed socket)))
(.write writer (str input "\n")) (.write writer (str input "\n"))
(.flush writer) (.flush writer)
(recur reader writer))))) (recur)))))
(defn- connect-to-server [socket handler] (defn- connect-to-server [socket handler]
(let [reader (InputStreamReader. (.getInputStream socket)) (let [reader (InputStreamReader. (.getInputStream socket))

View file

@ -1,12 +1,11 @@
#-*- mode: org -*-
#+startup: overview
#+startup: hidestars
#+TODO: TODO | INPROGRESS | DONE
Leiningen TODOs Leiningen TODOs
See also https://github.com/technomancy/leiningen/issues See also https://github.com/technomancy/leiningen/issues
* For 1.6.3
- [X] System/exit in repl (#324)
- [ ] Fix JVM_OPTS escaping
- [ ] help task in Windows doesn't show text (#323)
* For 1.6.2 * For 1.6.2
- [X] resources with eval-in-leiningen (#248) - [X] resources with eval-in-leiningen (#248)
- [X] fix :omit-default-repositories wrt central (#211) - [X] fix :omit-default-repositories wrt central (#211)
@ -40,12 +39,11 @@ See also https://github.com/technomancy/leiningen/issues
- [X] Merge native-deps - [X] Merge native-deps
- [X] Add leiningen.util.injected namespace - [X] Add leiningen.util.injected namespace
* For 1.5.1 * For 1.5.1
** TODO - [X] Move ns docstrings to :help-summary to allow AOT given CLJ-130.
- [X] Move ns docstrings to :help-summary to allow AOT given CLJ-130. - [X] Put :eval-in-lein deps in lib/dev for leiningen process access.
- [X] Put :eval-in-lein deps in lib/dev for leiningen process access. - [X] Revert back to :warn on checksum failure.
- [X] Revert back to :warn on checksum failure. - [X] Fix LEIN_ROOT warning in bin/lein.
- [X] Fix LEIN_ROOT warning in bin/lein. - [X] Honor user-settings in more places.
- [X] Honor user-settings in more places.
* For 1.5.0 * For 1.5.0
- unify auth options between :repositories and :deploy-to - unify auth options between :repositories and :deploy-to
- suppress socket closed stacktrace in interactive task - suppress socket closed stacktrace in interactive task
@ -123,19 +121,14 @@ See also https://github.com/technomancy/leiningen/issues
- upgrade task (patch submitted) - upgrade task (patch submitted)
- doc generation (autodoc plugin) - doc generation (autodoc plugin)
* For 1.0 * For 1.0
- Remove install task dependency on having Maven installed :Phil: - Remove install task dependency on having Maven installed
- Use -Xbootclasspath where possible :Dan: - Use -Xbootclasspath where possible
- Don't write manifest, pom, etc. to disk when jarring :Dan: - Don't write manifest, pom, etc. to disk when jarring
- Don't put uberjar in ~/.m2 :Phil: - Don't put uberjar in ~/.m2
- Perform compilation in either a subprocess or with a separate classloader - Perform compilation in either a subprocess or with a separate classloader
- Allow test task to take namespaces as an argument - Allow test task to take namespaces as an argument
- Fix eval-in-project to let plugins pass in extra args - Fix eval-in-project to let plugins pass in extra args
- Resources directory added to classpath (for properties, etc) - Resources directory added to classpath (for properties, etc)
* Plugin ideas
- metrics
- LOC
- complexity
- time logs
* Git-aware dependencies (experimental back-burner idea) * Git-aware dependencies (experimental back-burner idea)
Talking with Rich after Emerging Langs day 1 Talking with Rich after Emerging Langs day 1
Problem: you can pull in two versions of the same library Problem: you can pull in two versions of the same library