There are some hacky possibilities - eg testing for *1, but I don't think
there is a definitive way; there are many repls too (the clojure.main repl,
lein repl, lighttable), and a technique might not work on all of them.

Probably best to have some helper function you call from the repl, and have
that return the status code.  Then make your -main call that, followed by
System/exit with the return value.




On Thu, May 8, 2014 at 2:23 PM, Dave Tenny <dave.te...@gmail.com> wrote:

> When running as an uberjar, i.e. "java -jar myapp.jar [args]"
> the return code of the process to the shell is very important.
> System/exit is how that return code is sent.
>
>
> On Thu, May 8, 2014 at 9:20 AM, James Reeves <ja...@booleanknot.com>wrote:
>
>> Having your application call System/exit directly is often indicative of
>> some unnecessary coupling in your code.
>>
>> Under what circumstances does your application need to exit?
>>
>> - James
>>
>>
>> On 22 April 2014 17:59, Dave Tenny <dave.te...@gmail.com> wrote:
>>
>>> I have an app I'm building.  It calls System/exit.  That doesn't works
>>> so well if I'm debugging in the REPL however.
>>>
>>> What's the preferred method of determining whether I'm in REPL mode
>>> interaction vs running as a standalone app?
>>>
>>> Also, long as I'm asking and being lazy, does the -main function return
>>> value translate to a System/exit value if it's numeric?
>>> Or is System/exit the way to go?
>>>
>>> --
>>> 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
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> 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
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> 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
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> 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
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/KZJQsmOeiHc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to