aboutsummaryrefslogtreecommitdiffstats
path: root/pty-unix.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-09 21:20:51 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-09 21:20:51 -0400
commite9a9a54540ec467a5435c0b16fe2d9692e22cf7a (patch)
tree6c139ffa0614e61aac6c27ee39664b2e63da5c76 /pty-unix.c
parentc1b938e0388146dac6f82a65f6b972519cc6532b (diff)
downloadrunes-e9a9a54540ec467a5435c0b16fe2d9692e22cf7a.tar.gz
runes-e9a9a54540ec467a5435c0b16fe2d9692e22cf7a.zip
the subprocess dying should also close the window
Diffstat (limited to 'pty-unix.c')
-rw-r--r--pty-unix.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/pty-unix.c b/pty-unix.c
index 36b6939..4d27a73 100644
--- a/pty-unix.c
+++ b/pty-unix.c
@@ -62,9 +62,13 @@ static void runes_got_pty_data(uv_work_t *req, int status)
t = data->data.t;
if (data->len > 0) {
- runes_display_glyph(data->data.t, data->buf, data->len);
+ runes_handle_pty_read(t, data->buf, data->len);
uv_queue_work(t->loop, req, runes_read_pty, runes_got_pty_data);
}
+ else {
+ runes_handle_pty_close(t);
+ free(req);
+ }
}
void runes_pty_backend_loop_init(RunesTerm *t)
@@ -83,11 +87,18 @@ void runes_pty_backend_write(RunesTerm *t, char *buf, size_t len)
write(t->pty.master, buf, len);
}
+void runes_pty_backend_request_close(RunesTerm *t)
+{
+ RunesPtyBackend *pty;
+
+ pty = &t->pty;
+ kill(pty->child_pid, SIGHUP);
+}
+
void runes_pty_backend_cleanup(RunesTerm *t)
{
RunesPtyBackend *pty;
pty = &t->pty;
close(pty->master);
- kill(pty->child_pid, SIGHUP);
}