about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-12 18:04:00 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-12 18:04:00 +0000
commit3fa0e7d4d3fbf0287cb8b716f1ce4c3595c2d32d (patch)
tree5f62524735b99d915503120e5a33a3778682adea
parentc44ff62d89c2f28f3b72239e1f5a726a9cb4ad9c (diff)
downloadzsh-3fa0e7d4d3fbf0287cb8b716f1ce4c3595c2d32d.tar.gz
zsh-3fa0e7d4d3fbf0287cb8b716f1ce4c3595c2d32d.tar.xz
zsh-3fa0e7d4d3fbf0287cb8b716f1ce4c3595c2d32d.zip
zsh-workers/9694
-rw-r--r--Src/init.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/init.c b/Src/init.c
index 08fd2a4c4..5a6139438 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -401,7 +401,10 @@ init_io(void)
     if (opts[MONITOR] && interact && (SHTTY != -1)) {
 	if ((mypgrp = GETPGRP()) > 0) {
 	    while ((ttpgrp = gettygrp()) != -1 && ttpgrp != mypgrp) {
+		sleep(1);	/* give parent time to change pgrp */
 		mypgrp = GETPGRP();
+		if (mypgrp == mypid)
+		    attachtty(mypgrp);
 		if (mypgrp == gettygrp())
 		    break;
 		killpg(mypgrp, SIGTTIN);
@@ -411,7 +414,6 @@ init_io(void)
 	    opts[MONITOR] = 0;
     } else
 	opts[MONITOR] = 0;
-    attachtty(GETPGRP());
 #else
     opts[MONITOR] = 0;
 #endif