If main doesn't match the behavior of Repl and Script in this area when run in repl or script modes respectively, it needs to. Repl calls exit, Script does not.
Rich On Dec 21, 2008, at 4:30 PM, Stephen C. Gilardi wrote: > Based on the bottom of the ruby code example on this page: > > http://rjack.rubyforge.org/jetty/classes/Jetty/ServerFactory.html > > A first guess is that this would work: > > (.start server) > (.join server) > > Join will wait for the thread to exit before continuing. That code > makes sense if server is an instance of Thread. > > --Steve > > On Dec 21, 2008, at 4:16 PM, Mark McGranaghan wrote: > >> >> I have another quick observation: >> >> The (System/exit 0) bit at the end of the main function changes the >> behavior of some scripts I have for starting Jetty servers. The >> scripts basically end with (.start server), were server is a Jetty >> Server instance, and previously would run until control-C'd from the >> command line. I see in the linked thread above that this change in >> behavior is required by other aspects of Clojure, which makes senes >> to >> me. Do you know of any straiforward change I could make to these >> scripts to keep the servers running? Perhaps this is a matter of the >> Jetty APIs and not Clojure. >> >> I'm not using Compujre here, but looking quickly at Compojure it >> seems >> like it uses (.start server) as well from scripts. >> >> - Mark >> >> On Sun, Dec 21, 2008 at 3:59 PM, Mark McGranaghan >> <mmcgr...@gmail.com> wrote: >>> Steve, >>> >>> Your version of repl_ln.clj works for me: >>> >>> 1:1 user=> (+ 1 2) >>> 3 >>> 1:2 user=> (throw (Exception. "test")) >>> java.lang.Exception: test (repl-1:2) >>> >>> Thanks again, >>> - Mark >>> >>> On Sun, Dec 21, 2008 at 3:47 PM, Stephen C. Gilardi <squee...@mac.com >>> > wrote: >>>> Hi Mark, >>>> >>>> Thanks for your work on polishing up Clojure's entry point >>>> situation. >>>> >>>> You're welcome. Thanks very much for the feedback. >>>> >>>> I've applied your patch and tried a series of typical entry point >>>> scenarios; all but one of them worked for me. Just for the record, >>>> here is what did work: >>>> - Using "-h" to get help >>>> - Using no options to boot into a repl >>>> - Running the repl with jLine >>>> - Using "-" to read from stdin >>>> - Running a script located based on a filesystem path >>>> - Running a script located relative to classpath >>>> - Using "-i" to load files before running a script >>>> - Using set! in one of these init files >>>> - Accessing *command-line-args* from a script >>>> >>>> Excellent, that's some fine coverage. I appreciate it! >>>> >>>> The one that didn't work was booting into a line-numbered repl, >>>> which >>>> is the setup I use now with trunk Clojure and Clojure-Contrib: >>>> java -cp clojure.jar:/Users/mmcgrana/Clojure/jars/clojure- >>>> contrib.jar >>>> clojure.main -e "(use 'clojure.contrib.repl-ln)" -e "(repl)" >>>> >>>> clojure.contrib.repl-ln will need an update if my patch is made >>>> part of >>>> Clojure. I'm attaching the copy I'm currently using (which has >>>> not gone >>>> through my usual pre-patch testing process, but is working for me.) >>>> Please let me know whether it works for you. >>>> Thanks! >>>> --Steve >>>> >>>> >>>> >>> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---