aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-16 16:07:55 +0000
committernicm <nicm>2020-05-16 16:07:55 +0000
commitdceb6a15d04a2b2e050ab41816d0df3fe224b416 (patch)
treec2810c4472b71fd21301b6391e1a38a4e0774777 /tty.c
parent126bacb473f7950a156944caba42fad5f1764287 (diff)
downloadrtmux-dceb6a15d04a2b2e050ab41816d0df3fe224b416.tar.gz
rtmux-dceb6a15d04a2b2e050ab41816d0df3fe224b416.tar.bz2
rtmux-dceb6a15d04a2b2e050ab41816d0df3fe224b416.zip
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.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tty.c b/tty.c
index c8efeac7..a1e2f2c6 100644
--- a/tty.c
+++ b/tty.c
@@ -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))
;