summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-10-31 06:08:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-10-31 06:08:27 -0700
commitc95a1b4225cd1669e9fc9148949c3f1d40c3840e (patch)
tree5636bdbcb3382d2063469ce7e8dc19f715c6c36d
parenta237fecae924bdf42688666e7c0984530052a831 (diff)
downloadtxr-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.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index 9e6ae732..845f3f25 100644
--- a/parser.c
+++ b/parser.c
@@ -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)