[plt-scheme] Re: Is there a way to do this?

From: narutocanada at gmail.com (narutocanada at gmail.com)
Date: Sun Sep 14 10:34:42 EDT 2008


On Sep 14, 2:07 pm, Matthew Flatt <mfl... at cs.utah.edu> wrote:
> At Sun, 14 Sep 2008 06:59:45 -0700 (PDT), "narutocan... at gmail.com" wrote:
>
> > Is there a way to find out during the interpretation of a program that
> > any error was encountered, either syntactical or run time error--
> > currently mzscheme always return 0 at the shell level:
>
> > cat any.sc | mzscheme ; echo $?
> > # always 0
>
> > Providing a user defined error function only catches certain error but
> > not syntactical or other run time error-- like "identifier not found".
> > I need a way to catch any error and exit with any value other then 0
> > for batch processing large number of test files.
>
> The exit status for `mzscheme' indicates an error if an error occurs
> during a command-line eval (using -e, etc.), load (using -f, -r, etc.),
> or require (using -l, etc.) when no read-eval-print loop is started.
> Otherwise, the exit status is 0 or determined by a call to exit.
>
> (That's from 16.1.1 in the PLT Scheme reference, but I edited it a
> little to fill in some context.)
>
> So you might just want
>
>   mzscheme any.sc ; echo $?
>
> 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.


Thanks.

>
> Matthew
>
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.