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

Environment variable not set when launching session from tmux #184

Closed
k4nar opened this issue Oct 20, 2016 · 7 comments
Closed

Environment variable not set when launching session from tmux #184

k4nar opened this issue Oct 20, 2016 · 7 comments

Comments

@k4nar
Copy link

k4nar commented Oct 20, 2016

Hello,
I have several tmuxp configuration files using environment to pass an env variable to the created session.
When I launch them from a terminal, the environment variables are set. But when I launch them from a running tmux session they are not.

Do you have idea what's causing this behavior?

Failing testcase

session_name: test
environment:
  FOO: bar
windows:
  - panes: ['env | grep FOO']

Running tmuxp load -y test.yml shows FOO=bar, whereas launching the same command from a tmux session doesn't.

@romabysen
Copy link

I have noticed the same issue and I think it is due to the workspace being built in the current (or non-existing when outside tmux) session instead of the new one.

@askedrelic
Copy link

I've found a bug in libtmux which is causing this, @romabysen is correct. So I will try to fix libtmux and it should magically fix tmuxp.

@askedrelic
Copy link

tmux-python/libtmux#65 has fixed this for me locally, so this should be fixed with the next version of libtmux.

@tony
Copy link
Member

tony commented Aug 20, 2017

@askedrelic if you're around, try seeing if pip install -U libtmux and trying to load a fresh session in tmuxp works.

@tony
Copy link
Member

tony commented Aug 20, 2017

tmuxp 1.3.2 is live

@askedrelic
Copy link

askedrelic commented Aug 21, 2017

tmuxp 1.3.2 fixes this for me.

My use case for this has been restarting a tmuxp session, while I'm currently using it. I setup a bunch of ssh connections and restarting the whole session has always seemed like the easiest thing for me:

tmux-restart() {
    # kill client incase it exists
    tmux kill-session -t temp || TRUE
    # create detached session with commands
    tmux new-session -s temp -d 'sleep 1 && tmux kill-session -t dev && tmuxp load dev -y && tmux kill-session temp'
    tmux switch-client -t temp;
}

@k4nar
Copy link
Author

k4nar commented Aug 21, 2017

Indeed, tmuxp 1.3.2 seems to have fixed it. Thanks!

@k4nar k4nar closed this as completed Aug 21, 2017
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

No branches or pull requests

4 participants