From: Sam S. <sd...@gn...> - 2001-01-17 18:23:54
|
Let me remind my arguments: to get a non-0 exit status on error one has to use a CLISP-specific macro now, but with my proposed change on would be able to live with just the ANSI macros. I propose surrounding "-x" forms with EXIT-ON-ERROR, just like it is done with argv_execute_file now. Bruno, do you mind if I install the appended patch (it works for me)? > * In message <398...@gn...> > * On the subject of "Re: clisp exit status" > * Sent on Mon, 07 Aug 2000 19:50:03 -0400 > * I write: > > Bruno Haible wrote: > > > > Sam writes: > > > I noticed the following: > > > $ clisp -q -norc -x '(error)' > > > > > > *** - EVAL: too few arguments given to ERROR: (ERROR) > > > $ echo $? > > > 0 > > > $ > > > > > > shouldn't it be 1? > > > I mean, when the `-x' args raise an exception, shouldn't this be an > > > error? > > > > The current implementation gives an exit code of 1 if an -l (load) or > > -c (compile-file) option fails. But for the error handling of your own > > forms you are responsible yourself. The macro lisp:exit-on-error is > > documented; you can use it. If the -x form were wrapped inside a > > lisp:exit-on-error call by default, people who wish a different error > > behaviour would have a hard time to achieve it. > > it would seem more natural to exit with a status on error and let those > who don't like this wrap their code in ignore-errors. > > now: I want: > clisp -x (error) => 0 1 > clisp -x (ignore-errors (error)) => 0 0 > clisp -x (lisp:exit-on-error (error)) => 1 1 > -- Sam Steingold (http://www.podval.org/~sds) Support Israel's right to defend herself! <http://www.i-charity.com/go/israel> Read what the Arab leaders say to their people on <http://www.memri.org/> You think Oedipus had a problem -- Adam was Eve's mother. --- spvw.d.~1.133.~ Mon Jan 15 18:28:08 2001 +++ spvw.d Wed Jan 17 13:11:13 2001 @@ -2920,7 +2920,15 @@ } quit(); } - if (!(argv_execute_file == NULL)) + if (!(argv_expr == NULL)) + # *STANDARD-INPUT* auf einen Stream setzen, der argv_expr produziert: + { pushSTACK(asciz_to_string(argv_expr,O(misc_encoding))); + funcall(L(make_string_input_stream),1); + Symbol_value(S(standard_input)) = value1; + argv_execute_file = "-"; + # Dann den Driver aufrufen. Stringende -> EOF -> Programmende. + } + if (!(argv_execute_file == NULL) || (argv_expr != NULL)) # (PROGN # #+UNIX (SET-DISPATCH-MACRO-CHARACTER #\# #\! # #'SYS::UNIX-EXECUTABLE-READER) @@ -2966,13 +2974,6 @@ eval_noenv(form); } quit(); - } - if (!(argv_expr == NULL)) - # *STANDARD-INPUT* auf einen Stream setzen, der argv_expr produziert: - { pushSTACK(asciz_to_string(argv_expr,O(misc_encoding))); - funcall(L(make_string_input_stream),1); - Symbol_value(S(standard_input)) = value1; - # Dann den Driver aufrufen. Stringende -> EOF -> Programmende. } # Read-Eval-Print-Schleife aufrufen: driver(); |