summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-05 20:46:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-05 20:46:13 -0700
commit97984f6ec4d427c0730eea25a571a1cbe2c683de (patch)
tree9ad97f068bc4fcae71c8245914c413d3c33b8b6c
parent8c96d5de292bf732b815721702fc0d8f520c8291 (diff)
downloadtxr-97984f6ec4d427c0730eea25a571a1cbe2c683de.tar.gz
txr-97984f6ec4d427c0730eea25a571a1cbe2c683de.tar.bz2
txr-97984f6ec4d427c0730eea25a571a1cbe2c683de.zip
main: revise error-ignore strategy for Lisp file.
txr can process a Lisp file specified on the command line and then enter into the listener. In order to always enter the listener, even if the file errors out, the execution of the file uses read_eval_stream_noerr, which was written for this purpose. But this causes a problem for error reporting which is sensitive to whether or not an error handler exists. (See the compile-error function, and how it uses find-frame.) * txr.c (txr_main): Because we already know whether we are going to be entering the listener, we can split the evaluation of the Lisp file into two cases: if we will be entering the listener, we evaluate it with ignored error exceptions. If we won't be entering the listener, we evaluate normally. With this, I can run "make tests" now and be taken to the locaton of certain errors, due to the messages appearing on standard error.
-rw-r--r--txr.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/txr.c b/txr.c
index 9e9cc086..fbb0f927 100644
--- a/txr.c
+++ b/txr.c
@@ -1134,16 +1134,13 @@ int txr_main(int argc, char **argv)
std_error);
if (!enter_repl)
return result ? 0 : EXIT_FAILURE;
- } else {
- val result = read_eval_stream_noerr(self, parse_stream, spec_file_str,
- std_error);
-
+ } else if (enter_repl) {
+ read_eval_stream_noerr(self, parse_stream, spec_file_str, std_error);
close_stream(parse_stream, nil);
-
uw_release_deferred_warnings();
-
- if (!enter_repl)
- return result ? 0 : EXIT_FAILURE;
+ } else {
+ val result = read_eval_stream(self, parse_stream, std_error);
+ return result ? 0 : EXIT_FAILURE;
}
repl: