summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-16 14:38:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-16 14:38:52 -0700
commit7acbe1e1fff644f60637ad96610c93f76ccd2cf4 (patch)
tree0ec36017409f13a342f299d281a50c9408509bc5
parentf029f2815c2d69ef833089f476d32cadc5edd2de (diff)
downloadtxr-7acbe1e1fff644f60637ad96610c93f76ccd2cf4.tar.gz
txr-7acbe1e1fff644f60637ad96610c93f76ccd2cf4.tar.bz2
txr-7acbe1e1fff644f60637ad96610c93f76ccd2cf4.zip
cmdline: intercept errors from compiled files.
* txr.c (read_compiled_file_noerr): New static function. (txr_main): Use read_compied_file indirectly through read_compiled_file_noerr wrapper.
-rw-r--r--txr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/txr.c b/txr.c
index 5e5f7999..4a69c0ba 100644
--- a/txr.c
+++ b/txr.c
@@ -475,6 +475,13 @@ static int parse_once_noerr(val stream, val name, parser_t *parser)
ignerr_func_body(int, 0, parse_once(stream, name, parser), std_error, pfx);
}
+static val read_compiled_file_noerr(val self, val stream, val name, val error_stream)
+{
+ val pfx = format(nil, lit("~a:"), name, nao);
+ ignerr_func_body(val, nil, read_compiled_file(self, stream, error_stream),
+ std_error, pfx);
+}
+
static val read_eval_stream_noerr(val self, val stream, val name, val error_stream)
{
val pfx = format(nil, lit("~a:"), name, nao);
@@ -1077,7 +1084,8 @@ int txr_main(int argc, char **argv)
}
if (txr_lisp_p == chr('o')) {
- val result = read_compiled_file(self, parse_stream, std_error);
+ val result = read_compiled_file_noerr(self, parse_stream, spec_file_str,
+ std_error);
if (!enter_repl)
return result ? 0 : EXIT_FAILURE;
} else {