set RFNOTEG when we can

This commit is contained in:
rsc 2006-06-04 16:06:49 +00:00
parent 14695b90ac
commit 17558fbe2d
3 changed files with 14 additions and 1 deletions

View file

@ -76,10 +76,11 @@ _threadspawn(int fd[3], char *cmd, char *argv[])
return -1;
case 0:
/* can't RFNOTEG - will lose tty */
/* rfork(RFNOTEG); */
dup2(fd[0], 0);
dup2(fd[1], 1);
dup2(fd[2], 2);
if(!isatty(0) && !isatty(1) && !isatty(2))
rfork(RFNOTEG);
for(i=3; i<100; i++)
if(i != p[1])
close(i);