[plt-scheme] Re: Is there a way to do this?
On Sep 14, narutocanada at gmail.com wrote:
> On Sep 14, 2:07 pm, Matthew Flatt <mfl... at cs.utah.edu> wrote:
> >
> > If you really need to pipe expressions into the REPL, then you could
> > set `uncaught-exception-handler' to call `exit' with a non-0 value.
>
> Can you provide an example, I'm reading the manual at
> "http://download.plt-scheme.org/doc/html/reference/
> exns.html#(def._((quote._~23~25kernel)._uncaught-exception-handler))"
> , but it does not suggest an usage example. I can't figure out what to
> feed "with-handlers" or simply set! uncaught-exception-handler to
> exit? I simply need mzscheme to exit on any error and return none 0
> (like other unix programs). It seems mzscheme has some complicated
> exception system.
Something like
(uncaught-exception-handler (lambda (exn) (exit 1)))
should do what you want. But Matthew's suggestion of writing a proper
script file and run it as `mzscheme script' is much better. One thing
is that you won't get it to print the prompts and the welcome banner
line.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!