summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/parser.c b/parser.c
index c682f100..9a6217e8 100644
--- a/parser.c
+++ b/parser.c
@@ -473,6 +473,11 @@ static void provide_completions(const char *data,
}
}
+static val repl_intr(val signo, val async_p)
+{
+ uw_throw(error_s, lit("intr"));
+}
+
val repl(val bindings, val in_stream, val out_stream)
{
val ifd = stream_get_prop(in_stream, fd_k);
@@ -489,6 +494,7 @@ val repl(val bindings, val in_stream, val out_stream)
val result_hash = make_hash(nil, nil, nil);
val done = nil;
val counter = one;
+ val old_sig_handler = set_sig_handler(num(SIGINT), func_n2(repl_intr));
reg_varl(result_hash_sym, result_hash);
@@ -570,6 +576,7 @@ val repl(val bindings, val in_stream, val out_stream)
gc_hint(prompt);
}
+ set_sig_handler(num(SIGINT), old_sig_handler);
free(prompt_u8);
free(line_u8);
lino_free(ls);