Do not close the stdout file descriptor in control mode as it will be

needed for printing the exit messages. Fixes a bug when detaching with
iTerm2.
pull/2195/head
nicm 2020-04-27 08:35:09 +00:00
parent 18886cb510
commit 1574126e8a
1 changed files with 3 additions and 2 deletions

View File

@ -518,7 +518,7 @@ client_write_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
if (client_flags & CLIENT_CONTROL)
if (~client_flags & CLIENT_CONTROL)
close(msg->fd); /* can only be used once */
}
}
@ -673,7 +673,8 @@ client_read_open(void *data, size_t datalen)
errno = EBADF;
else {
cf->fd = dup(msg->fd);
close(msg->fd); /* can only be used once */
if (~client_flags & CLIENT_CONTROL)
close(msg->fd); /* can only be used once */
}
}
if (cf->fd == -1) {