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

add ${ENV_ROOT}/shims #5

Closed
wants to merge 1 commit into from
Closed

add ${ENV_ROOT}/shims #5

wants to merge 1 commit into from

Conversation

monmon
Copy link

@monmon monmon commented Dec 13, 2013

When tmux is started, the execution result of the
'$(${ENV_ROOT}/bin/${env} init -)' is 'source
$HOME/.anyenv/envs/plenv/libexec/../completions/plenv.zsh' instead of
export PATH additional shims.
So, is not available *env.

As a result of this commit, it will be read twice the shims, but I do
not care.
e.g.)
$HOME/.anyenv/envs/rbenv/bin
$HOME/.anyenv/envs/rbenv/shims
$HOME/.anyenv/envs/plenv/bin
$HOME/.anyenv/envs/plenv/shims
$HOME/.anyenv/envs/rbenv/shims
$HOME/.anyenv/envs/plenv/shims

When tmux is started, the execution result of the
'$(${ENV_ROOT}/bin/${env} init -)' is 'source
$HOME/.anyenv/envs/plenv/libexec/../completions/plenv.zsh' instead of
export PATH additional shims.
So, is not available * env.

As a result of this commit, it will be read twice the shims, but I do
not care.
e.g.)
$HOME/.anyenv/envs/rbenv/bin
$HOME/.anyenv/envs/rbenv/shims
$HOME/.anyenv/envs/plenv/bin
$HOME/.anyenv/envs/plenv/shims
$HOME/.anyenv/envs/rbenv/shims
$HOME/.anyenv/envs/plenv/shims
@riywo
Copy link
Member

riywo commented Dec 13, 2013

Thank you for the PR, but I can't understand the actual problem because I don't use tmux or screen. Could you show me more example outputs?

@monmon
Copy link
Author

monmon commented Dec 14, 2013

Thank you for responding.

Could you show me more example outputs?

What I done is as follows.

I added a line to libexec/anyenv-init.

102   echo "echo $(${ENV_ROOT}/bin/${env} init - ${shell})"

I started zsh. This output is

export PATH=/Users/monmon/.anyenv/envs/plenv/shims:/Users/monmon/.anyenv/bin:/Users/monmon/local/bin:/Users/monmon/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=/Users/monmon/.anyenv/envs/rbenv/shims:/Users/monmon/.anyenv/envs/plenv/shims:/Users/monmon/.anyenv/bin:/Users/monmon/local/bin:/Users/monmon/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

note. I'm using plenv and rbenv.

Next, I carried out tmux. This output is

source /Users/monmon/.anyenv/envs/plenv/libexec/../completions/plenv.zsh
source /Users/monmon/.anyenv/envs/rbenv/libexec/../completions/rbenv.zsh
source /Users/monmon/.anyenv/envs/plenv/libexec/../completions/plenv.zsh
source /Users/monmon/.anyenv/envs/rbenv/libexec/../completions/rbenv.zsh

and PATH is

% echo $PATH | perl -pe 's/:/\n/g'
/usr/local/heroku/bin
/Users/monmon/.anyenv/envs/rbenv/bin
/Users/monmon/.anyenv/envs/plenv/bin
/Users/monmon/.anyenv/bin
/Users/monmon/local/bin
/Users/monmon/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/monmon/.anyenv/envs/rbenv/shims
/Users/monmon/.anyenv/envs/plenv/shims

% which perl
/usr/bin/perl

% where perl
/usr/bin/perl
/Users/monmon/.anyenv/envs/plenv/shims/perl

I think there are some better ways to solve this trouble, but I don't know.
see. http://monmon.hateblo.jp/entry/2013/12/13/233242

@riywo
Copy link
Member

riywo commented Dec 17, 2013

Thank you for the description. Before merging this PR, I'd like to watch an issue of rbenv. So, I'll keep this PR opened for a while.


There are some workaround. Is one of them working in your situation?

Not executing path_helper when it is in tmux

rbenv/rbenv#369 (comment)

if [[ -z $TMUX ]] && [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

Not executing anyenv init when it is outside of tmux

http://pgib.me/blog/2013/12/04/tmux-and-zsh-part-2/

export PATH="$HOME/.anyenv/bin:$PATH"
if [ -n "$TMUX" ]; then
  eval "$(anyenv init -)"
fi

Note: in this case, you can't use anyenv in the shell outside of tmux.

@monmon
Copy link
Author

monmon commented Dec 21, 2013

Thank you for your research! I tried the two solutions, It worked!

I'm running zsh + tmux and setting anyenv in .zshenv.
In my environment, "Not executing path_helper" solution you cited did not work, but the following solution was successful.
rbenv/rbenv#369 (comment)

--- /etc/zshenv.orig
+++ /etc/zshenv
@@ -1,4 +1,5 @@
 # system-wide environment settings for zsh(1)
 if [ -x /usr/libexec/path_helper ]; then
+ PATH=""
  eval `/usr/libexec/path_helper -s`
 fi

As for "Not executing anyenv init", not working in .zshenv, but working in .zshrc.
When it was set in the .zshenv, no problem in a window, but it did not work to make a window of the second.

Thanks!

t17a added a commit to t17a/dotfiles that referenced this pull request Jul 23, 2015
@riywo
Copy link
Member

riywo commented Jan 20, 2019

Sorry, I have completely forgot the context and I'm now building a new repository. https://github.com/anyenv/anyenv

If you still need this patch, please consider to submit PR to the new repository since this repository will be deprecated.

@riywo riywo closed this Jan 20, 2019
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 this pull request may close these issues.

None yet

2 participants