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
commit2a96c6ec27d1dd987897a566dd850f871cef46da (patch)
tree9ad97f068bc4fcae71c8245914c413d3c33b8b6c
parentad177acffef725169f3dcf9bf87e487251da92e5 (diff)
downloadtxr-2a96c6ec27d1dd987897a566dd850f871cef46da.tar.gz
txr-2a96c6ec27d1dd987897a566dd850f871cef46da.tar.bz2
txr-2a96c6ec27d1dd987897a566dd850f871cef46da.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: