diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-02-04 23:45:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-02-04 23:45:03 -0800 |
commit | b7a7370a921bbc02b54d87600ff74d5cb9efde28 (patch) | |
tree | 4630b23c06624a225eb9ca8cb3c8801f70021221 | |
parent | 11d7121c55f20268f7b8950ab4130922905d6720 (diff) | |
download | txr-b7a7370a921bbc02b54d87600ff74d5cb9efde28.tar.gz txr-b7a7370a921bbc02b54d87600ff74d5cb9efde28.tar.bz2 txr-b7a7370a921bbc02b54d87600ff74d5cb9efde28.zip |
repl: catch exceptions during completion.
This fixes the issue that TXR exits if an exception occurs
during Tab completion in the interactive listener.
This could happen when loading a file fails for whatever
reason, such as a corrupt or incomplete installation
of the library files or whatever.
* parser.c (provide_completions): Set up a catch all handler
here around everything, like we already did in provide_atom.
-rw-r--r-- | parser.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -924,15 +924,17 @@ static void provide_completions(const wchar_t *data, (void) ctx; + uw_catch_begin (catch_all, exsym, exvals); + if (!ptr) - return; + goto out; while ((iswalnum(convert(wint_t, *ptr)) || wcschr(gly, *ptr)) && (sym = ptr) && ptr > data) ptr--; if (!sym) - return; + goto out; end = sym; @@ -999,6 +1001,16 @@ static void provide_completions(const wchar_t *data, sym_pfx, line_pfx, kind, if2(package, null(keyword))); } } + +out: + uw_catch (exsym, exvals) { + (void) exsym; + (void) exvals; + } + + uw_unwind; + + uw_catch_end; } static wchar_t *provide_atom(lino_t *l, const wchar_t *str, int n, void *ctx) |