$ java -cp clojure.jar clojure.main -e "garbage"
java.lang.Exception: Unable to resolve symbol: garbage in this context
(NO_SOURCE_FILE:0)
at clojure.lang.Compiler.analyze(Compiler.java:4330)
.......etc
$ echo $?
0
Likewise with a script. This seems like a bug. Would it be acceptable
to change clojure.main/main as follows?
Currently it does this:
(try
.... the good stuff ...
(catch Exception e
(.printStackTrace e *err*)))
(flush))
Instead I'd like it to:
(try
.... the good stuff ...
(flush)
(catch Exception e
(flush)
(throw e)))
Basically just let Java do what Java does when an unhandled exception
is thrown (after flushing *out* to keep from confusing people). I know
a lot of what's in clojure.main is meant to be useful for embedding in
larger programs, but it doesn't look to me like the main function is
intended for that.
Thanks.
-hume.
--
http://elhumidor.blogspot.com/
Any ideas?
Aaron
On Apr 8, 2009, at 2:28 PM, Tom Faulhaber wrote:
I'd like to second this request. It's pretty necessary to have an exit
code for any type of scripting.
Of course, you can always use (System/exit result-code), but a return
value is "prettier" to me.
---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/
Thanks.
-hume.
On Sun, Apr 5, 2009 at 8:15 PM, John D. Hume <duelin....@gmail.com> wrote:
> Currently it does this:
> (try
> .... the good stuff ...
> (catch Exception e
> (.printStackTrace e *err*)))
> (flush))
>
> Instead I'd like it to:
> (try
> .... the good stuff ...
> (flush)
> (catch Exception e
> (flush)
> (throw e)))
>
> Basically just let Java do what Java does when an unhandled exception
> is thrown (after flushing *out* to keep from confusing people). I know
> a lot of what's in clojure.main is meant to be useful for embedding in
> larger programs, but it doesn't look to me like the main function is
> intended for that.