summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-06-08 21:40:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-06-08 21:40:13 -0700
commit29a81bdfbfaae1bdf93cb6d1a0bd2220cf5c9785 (patch)
tree3bf21d39d99170288359e0ea0d83d458b8fe896f
parent09ff41d82cbc75cdb07b61bb3c35bfa07f897a8d (diff)
downloadtxr-29a81bdfbfaae1bdf93cb6d1a0bd2220cf5c9785.tar.gz
txr-29a81bdfbfaae1bdf93cb6d1a0bd2220cf5c9785.tar.bz2
txr-29a81bdfbfaae1bdf93cb6d1a0bd2220cf5c9785.zip
listener: bugfix: handle warnings around linenoise.
* parser.c (repl): Also push and pop the warning handler around the linenoise call, like we do around evaluation. The reason is that when the library is used in source code form, it can generate warnings while loading. Loading can be triggered by completion from inside linenoise. Neglecting to handle warnings and throw a continue causes a problem because the warnings then fall victim to the listener's master catch. That then interferes with the load.
-rw-r--r--parser.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/parser.c b/parser.c
index 60fd0655..1a375bd7 100644
--- a/parser.c
+++ b/parser.c
@@ -1647,8 +1647,12 @@ val repl(val bindings, val in_stream, val out_stream, val env)
uw_catch_begin (catch_all, exsym, exvals);
+ uw_push_handler(&uw_handler, cons(warning_s, nil), rw_f);
+
line_w = linenoise(ls, c_str(prompt, self));
+ uw_pop_frame(&uw_handler);
+
#if CONFIG_FULL_REPL
rplacd(multi_line_var, tnil(lino_get_multiline(ls)));
#endif