about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-13 13:14:45 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-13 13:14:45 +0000
commit326d6825104fbaedf569e169b04043c29bc3d845 (patch)
treed88b732c56757962b324850dab53908ebb3e86ce
parent90b07817db10a67cc58d5bcad20ab6fc191146de (diff)
downloadzsh-326d6825104fbaedf569e169b04043c29bc3d845.tar.gz
zsh-326d6825104fbaedf569e169b04043c29bc3d845.tar.xz
zsh-326d6825104fbaedf569e169b04043c29bc3d845.zip
try to make the -t option of zpty smarter (13462)
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/zpty.c16
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 094569922..4bddff7c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-02-13  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* 13462: Src/Modules/zpty.c: try to make the -t option of zpty
+ 	smarter
+	
 	* 13459: Completion/Core/_path_files: wehn using glob_complete,
  	don't treat everything starting with a tilde as a pattern
 	
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