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 | 157e051e3cb9232509b6df1dd57f4ae172809f25 (patch) | |
tree | 5636bdbcb3382d2063469ce7e8dc19f715c6c36d /parser.c | |
parent | 5389099d2c9b5f2476499f3813dbcbd2eb44235a (diff) | |
download | txr-157e051e3cb9232509b6df1dd57f4ae172809f25.tar.gz txr-157e051e3cb9232509b6df1dd57f4ae172809f25.tar.bz2 txr-157e051e3cb9232509b6df1dd57f4ae172809f25.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.
Diffstat (limited to 'parser.c')
-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) |