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
commit157e051e3cb9232509b6df1dd57f4ae172809f25 (patch)
tree5636bdbcb3382d2063469ce7e8dc19f715c6c36d
parent5389099d2c9b5f2476499f3813dbcbd2eb44235a (diff)
downloadtxr-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.
-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)