5 ms·
The one thing I hate about tmux is that it leaks env vars across instances: # terminal 1, start a fresh first tmux session, which magically spawns a daemon
by lloeki 2y ago
The one thing I hate about tmux is that it leaks env vars across instances:
# terminal 1, start a fresh first tmux session, which magically spawns a daemon with the same env
$ env FOO=bar tmux
# terminal 2, start another tmux session, which reuses the daemon's env
$ tmux
$ echo $FOO
bar
Try the same with `screen` and you're safe.
This is especially annoying when you're using, say, direnv, and project-specific env vars appear magically on an unrelated subsequent session because your first `tmux` turned out to be from a direnv-enabled directory, which polluted the global environment, which in turn pollutes every subsequent session environment as long as a session (not necessarily the original one) is alive.
Replace FOO with SOME_SECRET/ACCESS_KEY/TOKEN and you can actually accidentally expose/leak stuff or point to the wrong thing.
The unattended workaround is to have the tmux daemon spawn at login via `start-server` + enable some tmux settings like `exit-empty` plus some I can't recall regarding environment handling, but nobody does that.
- Arnavion 2y agoYou can start the server as a user session service if you have a service manager for that, like systemd, instead of needing to do it manually. For systemd specifically, tmux also supports socket activation for the server since some time ago, so you can do that to start it on-demand.
- rauhl 2y ago> The unattended workaround is to have the tmux daemon spawn at login via `start-server` + enable some tmux settings like `exit-empty` plus some I can't recall regarding environment handling, but nobody does that. I just have my terminal emulator spin up tmux when it starts, and I start my terminal emulator from my desktop, so it always runs in a clean environment.
- deleted 2y ago[deleted]