Add a -D flag to ask tmux not to daemonize, useful both for running a debugger

(lldb does not have follow-fork-mode) and for running with a managed supervisor
init system. GitHub issue 2190.
This commit is contained in:
Nicholas Marriott
2020-05-10 16:52:46 +01:00
parent 5fa377d927
commit d01e7aac89
7 changed files with 73 additions and 25 deletions

7
tty.c
View File

@@ -154,16 +154,21 @@ tty_read_callback(__unused int fd, __unused short events, void *data)
{
struct tty *tty = data;
struct client *c = tty->client;
const char *name = c->name;
size_t size = EVBUFFER_LENGTH(tty->in);
int nread;
nread = evbuffer_read(tty->in, tty->fd, -1);
if (nread == 0 || nread == -1) {
if (nread == 0)
log_debug("%s: read closed", name);
else
log_debug("%s: read error: %s", name, strerror(errno));
event_del(&tty->event_in);
server_client_lost(tty->client);
return;
}
log_debug("%s: read %d bytes (already %zu)", c->name, nread, size);
log_debug("%s: read %d bytes (already %zu)", name, nread, size);
while (tty_keys_next(tty))
;