diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-10-31 06:08:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-10-31 06:08:27 -0700 |
commit | c95a1b4225cd1669e9fc9148949c3f1d40c3840e (patch) | |
tree | 5636bdbcb3382d2063469ce7e8dc19f715c6c36d | |
parent | a237fecae924bdf42688666e7c0984530052a831 (diff) | |
download | txr-c95a1b4225cd1669e9fc9148949c3f1d40c3840e.tar.gz txr-c95a1b4225cd1669e9fc9148949c3f1d40c3840e.tar.bz2 txr-c95a1b4225cd1669e9fc9148949c3f1d40c3840e.zip |
repl: bugfix: abort on window size change.
* parser.c (lino_getch): Catch the exception that is thrown by
get_char when the read fails with EINTR due to the SIGWINCH
interrupt. Convert exception to WEOF return.
-rw-r--r-- | parser.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -1431,9 +1431,27 @@ static int lino_puts(mem_t *stream_in, const wchar_t *str_in) static wint_t lino_getch(mem_t *stream_in) { - val stream = coerce(val, stream_in); - val ch = get_char(stream); - return if3(ch, c_num(ch), WEOF); + wint_t ret = WEOF; + + val stream, ch; + + uw_catch_begin (catch_all, sy, va); + + stream = coerce(val, stream_in); + ch = get_char(stream); + + ret = if3(ch, c_num(ch), WEOF); + + uw_catch (sy, va) { + (void) sy; + (void) va; + } + + uw_unwind { } + + uw_catch_end; + + return ret; } static wchar_t *lino_getl(mem_t *stream_in, wchar_t *buf, size_t nchar) |