opened
hughrawlinson
username_0
Hi,

I'm encountering an issue where my environment isn't captured due to a zsh plugin I'm running. I run the (tmux plugin)[https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins#tmux] for (oh-my-zsh)[https://github.com/robbyrussell/oh-my-zsh/] with the `ZSH_TMUX_AUTOSTART` option turned on, which means that when `/bin/zsh -i` is run, it opens up tmux and causes issues for non-interactive processes opening it up expecting a prompt but getting a tmux instead. I've encountered this issue with my text editor also, but was able to configure my text editor not to use interactive mode, which works for me because I only start up tmux automatically in interactive mode.

I understand that in practice, people are likely to set their environments in their `.zshrc`, so simply turning off interactive mode would not be an acceptable solution in this case. I'm wondering if you'd be open to a PR which detects whether or not the appropriate environment from running interactive mode, and if not, running non-interactive mode to see if it can gather more environment?
Fallback from Interactive Mode
issue
created
sindresorhus
username_1
How would you detect that?

-

@username_2 Thoughts?
comment
created
silverwind
username_2
@username_0 does `-t` (SINGLE_COMMAND option) help, e.g. `zsh -tilc "env;exit"`.
comment
created
hughrawlinson
username_0
The tmux autostart happens when a certain environmental variable is set, so if there were a way to differentiate this call to zsh from an ordinary shell where tmux would be useful, I could only set that variable if interactive mode was on. It looks like `-t` works for this. I'm not sure how to be absolutely sure, but executing `zsh -tilc "env;exit"` does print my environment and exit the shell without trying to start tmux.
comment