Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback from Interactive Mode #4

Open
hughrawlinson opened this issue Jul 27, 2016 · 3 comments
Open

Fallback from Interactive Mode #4

hughrawlinson opened this issue Jul 27, 2016 · 3 comments

Comments

@hughrawlinson
Copy link

hughrawlinson commented Jul 27, 2016

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 for 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?

@sindresorhus
Copy link
Owner

I'm open to adding a workaround. Is there anything we could do to prevent the tmux auto-start? That would be a better solution.

I'm wondering if you'd be open to a PR which detects whether or not the appropriate environment from running interactive mode

How would you detect that?

@silverwind Thoughts?

@silverwind
Copy link
Collaborator

@hughrawlinson does -t (SINGLE_COMMAND option) help, e.g. zsh -tilc "env;exit".

@hughrawlinson
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants