From 326d6825104fbaedf569e169b04043c29bc3d845 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 13 Feb 2001 13:14:45 +0000 Subject: try to make the -t option of zpty smarter (13462) --- Src/Modules/zpty.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Src/Modules') diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index f96ffa0e3..c69aa4e97 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -430,13 +430,19 @@ deleteallptycmds(void) static void checkptycmd(Ptycmd cmd) { - if (cmd->read != -1) + char c; + int r; + + if (cmd->read != -1 || cmd->fin) + return; + if ((r = read(cmd->fd, &c, 1)) < 0) { + if (kill(cmd->pid, 0) < 0) { + cmd->fin = 1; + zclose(cmd->fd); + } return; - if (!read_poll(cmd->fd, &cmd->read, 0) && - kill(cmd->pid, 0) < 0) { - cmd->fin = 1; - zclose(cmd->fd); } + if (r) cmd->read = (int) c; } static int -- cgit v1.2.3-70-g09d2