=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/client.c,v retrieving revision 1.145 retrieving revision 1.146 diff -u -r1.145 -r1.146 --- src/usr.bin/tmux/client.c 2020/05/26 08:41:47 1.145 +++ src/usr.bin/tmux/client.c 2020/06/01 09:43:00 1.146 @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.145 2020/05/26 08:41:47 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.146 2020/06/01 09:43:00 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -384,6 +384,11 @@ client_exec(client_execshell, client_execcmd); } + /* Restore streams to blocking. */ + setblocking(STDIN_FILENO, 1); + setblocking(STDOUT_FILENO, 1); + setblocking(STDERR_FILENO, 1); + /* Print the exit message, if any, and exit. */ if (client_attached) { if (client_exitreason != CLIENT_EXIT_NONE) @@ -392,18 +397,17 @@ ppid = getppid(); if (client_exittype == MSG_DETACHKILL && ppid > 1) kill(ppid, SIGHUP); - } else if (client_flags & CLIENT_CONTROLCONTROL) { + } else if (client_flags & CLIENT_CONTROL) { if (client_exitreason != CLIENT_EXIT_NONE) printf("%%exit %s\n", client_exit_message()); else printf("%%exit\n"); - printf("\033\\"); - tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + if (client_flags & CLIENT_CONTROLCONTROL) { + printf("\033\\"); + tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + } } else if (client_exitreason != CLIENT_EXIT_NONE) fprintf(stderr, "%s\n", client_exit_message()); - setblocking(STDIN_FILENO, 1); - setblocking(STDOUT_FILENO, 1); - setblocking(STDERR_FILENO, 1); return (client_exitval); }