Deleting one of the jar files in the sample test project
was failing on Windows, which was causing all sorts of hard to debug
test errors.
Calling System/gc seems to do the trick (at least on Vista),
but it is not really a proper solution.
If anybody has a better idea, please speak up.
There's too much opportunity for collision to make this a generalized
feature; let's just use it to get the six forms required for add-hook
and thus retest/test selectors.
There were three related problems:
1) The first argument was always parsed with read-string, even
when defaulting to the :main namespace. This caused
non-numeric first arguments to throw:
Exception in thread "main" java.lang.Exception: Unable to
resolve symbol: foo in this context
Avoid read-string entirely and update the unit tests to use an
unreadable string instead of a number to make the problem obvious.
This problem was reported by Marek Kubica on the Clojure
mailing list.
2) When using an alias the alias keyword was passed to -main as the
first argument. This is inconsistent with how the -m and :main
simply pass the program arguments, not the namespace or -m flag.
3) There was no way to pass "-m" or a string beginning with ":"
as a first argument to the run program. Added "--" as an option
to escape these.
RuntimeMXBean.getInputArguments is buggy when an input argument contains spaces.
For an input argument of "-Dmyprop=hello world" it returns two arguments, split at the
space: "-Dmyprop=hello" and "world".
This causes eval-in-project to fail in spectacular ways when leiningen.original.pwd
contains spaces or when path to the clojure jar that gets passed to -Xbootclasspath
contains spaces (which it does by default on Windows XP).