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.

On Apr 5, 5:15 pm, "John D. Hume" <duelin.mark...@gmail.com> wrote:
> Earlier today I was surprised to notice that some test-is unit tests I
> was running from Ant failed, but it still reported BUILD SUCCESSFUL. I
> figured I'd forgotten to include failonerror="true" in the java task,
> but it was there. So I played around and found that
>
> $ 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/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to