cs: fix exit status on error
Also, fix some error messages in non-CS Racket, and add a clarification on exit status in the Reference.
This commit is contained in:
parent
0b022b2ef4
commit
89db60abc9
|
@ -121,7 +121,9 @@ specified. Requiring @racketmodname[racket/gui/base] sets this parameter call
|
|||
The default exit status for a Racket or GRacket process is non-zero if
|
||||
an error occurs during a command-line @racket[eval] (via @Flag{e},
|
||||
etc.), @racket[load] (via @Flag{f}, @Flag{r}, etc.), or
|
||||
@racket[require] (via @Flag{-l}, @Flag{t}, etc.), but only when no
|
||||
@racket[require] (via @Flag{l}, @Flag{t}, etc.)---or, more generally,
|
||||
if the abort handler of the @tech{prompt} surrounding those evalutions
|
||||
is called---but only when no
|
||||
read-eval-print loop is started. Otherwise, the default exit status is
|
||||
@racket[0].
|
||||
|
||||
|
|
|
@ -481,10 +481,21 @@
|
|||
(when init-library
|
||||
(namespace-require+ init-library))
|
||||
|
||||
(for-each (lambda (ld) (ld))
|
||||
(reverse loads))
|
||||
(call-with-continuation-prompt
|
||||
(lambda ()
|
||||
(for-each (lambda (ld) (ld))
|
||||
(reverse loads)))
|
||||
(default-continuation-prompt-tag)
|
||||
;; If any load escapes, then set the exit value and
|
||||
;; stop running loads (but maybe continue with the REPL)
|
||||
(lambda (proc)
|
||||
(set! exit-value 1)
|
||||
;; Let the actual default handler report an arity mismatch, etc.
|
||||
(call-with-continuation-prompt
|
||||
(lambda () (abort-current-continuation (default-continuation-prompt-tag) proc)))))
|
||||
|
||||
(when repl?
|
||||
(set! exit-value 0)
|
||||
(when repl-init?
|
||||
(let ([m (get-repl-init-filename)])
|
||||
(when m
|
||||
|
@ -498,6 +509,6 @@
|
|||
(unless gracket?
|
||||
(newline)))
|
||||
|
||||
(|#%app| (|#%app| executable-yield-handler) 0)
|
||||
(|#%app| (|#%app| executable-yield-handler) exit-value)
|
||||
|
||||
(exit exit-value))))
|
||||
|
|
|
@ -1155,7 +1155,7 @@ static void *apply_again_k(void)
|
|||
|
||||
if (num_vals != 1) {
|
||||
scheme_wrong_return_arity("call-with-continuation-prompt", 1, num_vals, (Scheme_Object **)val,
|
||||
"application of default prompt handler");
|
||||
"\n in: application of default prompt handler");
|
||||
return NULL;
|
||||
} else {
|
||||
scheme_check_proc_arity("default-continuation-prompt-handler", 0, 0, 1, &val);
|
||||
|
@ -6699,9 +6699,9 @@ static Scheme_Object **chaperone_do_control(const char *name, int mode,
|
|||
* as the number of aborted values
|
||||
*/
|
||||
if (num_args == 1 && num_args != argc)
|
||||
scheme_wrong_return_arity(name, argc, 1, (Scheme_Object **)(vals[0]), "use of redirecting procedure");
|
||||
scheme_wrong_return_arity(name, argc, 1, (Scheme_Object **)(vals[0]), "\n in: use of redirecting procedure");
|
||||
else if (num_args != argc)
|
||||
scheme_wrong_return_arity(name, argc, num_args, vals, "use of redirecting procedure");
|
||||
scheme_wrong_return_arity(name, argc, num_args, vals, "\n in: use of redirecting procedure");
|
||||
|
||||
if (mode == 3) {
|
||||
if (!scheme_check_proc_arity(NULL, 1, 0, argc, vals)) {
|
||||
|
@ -7080,7 +7080,7 @@ static Scheme_Object *call_with_prompt (int in_argc, Scheme_Object *in_argv[])
|
|||
scheme_check_proc_arity("default-continuation-prompt-handler", 0, 0, argc, argv);
|
||||
} else {
|
||||
scheme_wrong_return_arity("call-with-continuation-prompt", 1, argc, argv,
|
||||
"application of default prompt handler");
|
||||
"\n in: application of default prompt handler");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user