diff options
author | nicm <nicm> | 2020-05-16 16:07:55 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-05-16 16:07:55 +0000 |
commit | dceb6a15d04a2b2e050ab41816d0df3fe224b416 (patch) | |
tree | c2810c4472b71fd21301b6391e1a38a4e0774777 /tmux.c | |
parent | 126bacb473f7950a156944caba42fad5f1764287 (diff) | |
download | rtmux-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 'tmux.c')
-rw-r--r-- | tmux.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -57,7 +57,7 @@ static __dead void usage(void) { fprintf(stderr, - "usage: %s [-2CluvV] [-c shell-command] [-f file] [-L socket-name]\n" + "usage: %s [-2CDluvV] [-c shell-command] [-f file] [-L socket-name]\n" " [-S socket-path] [-T features] [command [flags]]\n", getprogname()); exit(1); @@ -336,7 +336,7 @@ main(int argc, char **argv) if (**argv == '-') flags = CLIENT_LOGIN; - while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:T:uUvV")) != -1) { + while ((opt = getopt(argc, argv, "2c:CDdf:lL:qS:T:uUvV")) != -1) { switch (opt) { case '2': tty_add_features(&feat, "256", ":,"); @@ -344,6 +344,9 @@ main(int argc, char **argv) case 'c': shell_command = optarg; break; + case 'D': + flags |= CLIENT_NOFORK; + break; case 'C': if (flags & CLIENT_CONTROL) flags |= CLIENT_CONTROLCONTROL; @@ -387,6 +390,8 @@ main(int argc, char **argv) if (shell_command != NULL && argc != 0) usage(); + if ((flags & CLIENT_NOFORK) && argc != 0) + usage(); if ((ptm_fd = getptmfd()) == -1) err(1, "getptmfd"); |