vfox icon indicating copy to clipboard operation
vfox copied to clipboard

tmux inherits environment variables causing __VFOX_CURTMPPATH to be reused

Open jan-bar opened this issue 1 year ago • 11 comments

          a bit better screen that may give you some additional hints
image

Originally posted by @ZuBB in https://github.com/version-fox/vfox/issues/364#issuecomment-2443873158

jan-bar avatar Oct 30 '24 01:10 jan-bar

@ZuBB

Use the following tmux configuration to see if there is any problem with my verification.

cat ~/.tmux.conf 

set-option -g default-command "env -u __VFOX_CURTMPPATH -u __VFOX_PID -u __VFOX_SHELL fish"

jan-bar avatar Oct 30 '24 02:10 jan-bar

this config/option did the trick @jan-bar

image

ZuBB avatar Nov 07 '24 18:11 ZuBB

@ZuBB I'm glad to solve this problem. The reason for the problem is that tmux will inherit environment variables when creating a new terminal, and the __VFOX_XXX environment variables have special uses.

jan-bar avatar Nov 08 '24 01:11 jan-bar

So is there a fix for this issue on your side, or I have to tweak config of tmux?

ZuBB avatar Nov 08 '24 05:11 ZuBB

I don’t have a good solution, and many people are troubled by this feature of tmux, which can be avoided by modifying the tmux configuration, so I don’t think it’s necessary to fix it.

jan-bar avatar Nov 08 '24 05:11 jan-bar

Then maybe adding a note to the docs would be nice?

ZuBB avatar Nov 08 '24 05:11 ZuBB

Yes, you can submit a PR. I haven't submitted a PR related to documentation yet. :smile:

jan-bar avatar Nov 08 '24 07:11 jan-bar

I don’t have a good solution, and many people are troubled by this feature of tmux, which can be avoided by modifying the tmux configuration, so I don’t think it’s necessary to fix it.

I encountered a similar problem when using fish + tmux + vfox: when I reconnect to an existing tmux, my vfox environment is often lost(dotnet, node). And I find this issue. Could you give me a sample tmux configuration to avoid this problem? Thanks a lot~

AliveNeko avatar Dec 18 '24 01:12 AliveNeko

@AliveNeko You can use this solution https://github.com/version-fox/vfox/issues/375#issuecomment-2445725062 ,The principle is to remove those environment variables through the subprocess started by tmux.

jan-bar avatar Dec 18 '24 02:12 jan-bar

@AliveNeko You can use this solution #375 (comment) ,The principle is to remove those environment variables through the subprocess started by tmux.

My bad, I didn't see the above configuration. Thank you very much!❤️

AliveNeko avatar Dec 18 '24 02:12 AliveNeko

I would like to add that this also happens if you launch the system from the tty in linux. I solved it by adding an script to my .zshrc to only activate vfox when the terminal is not the tty. I think that this also should be added to the docs.

breno-villa avatar Mar 06 '25 10:03 breno-villa