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

Auto reshim #409

Open
jayvdb opened this issue Nov 28, 2018 · 6 comments
Open

Auto reshim #409

jayvdb opened this issue Nov 28, 2018 · 6 comments

Comments

@jayvdb
Copy link

jayvdb commented Nov 28, 2018

Steps to reproduce

Install any binaries with most plugins, including rust, python.

According to code-lever/asdf-rust#14 (comment) , nodejs does a reshim sometimes.

Expected behavior

reshim should occur automatically whenever possible.

Actual behavior

Users are regularly wondering why the binaries they have installed are not available.

One very easy way to detect a reshim is needed is for plugins to expose a list of filenames which when modified indicate a reshim is needed.

Typically, the plugins would provide a list of lock filenames which may appear in the source tree.

A slightly more complicated approach is for plugins to expose a list of directories in the plugin installs area which are where new binaries will appear, and should be auto-reshimmed.

@vic
Copy link
Contributor

vic commented Jan 19, 2019

Current master supports pre/post command hooks (#434), you could use something like

This example will reshim after you execute cargo install

# in your $HOME/.asdfrc
post_rust_cargo = my_post_cargo_install_hook ${@}
#!/usr/bin/env bash
# This is my_post_cargo_install_hook

# when cargo was called with install as first argument, reshim
if [ "install" == "$1" ] ; then
   asdf reshim rust
fi

@tutume
Copy link

tutume commented Nov 5, 2019

Hi, I'm new to asdf and python and faced with this issue with python pip, searched and found this which points to here.
Anyways. For a possible global solution, would be possible to add and change the PATH to point to the currently active language/bin directory, this way, it would work for all language I suppose. What are the restrictions for this possible solution?

@vic
Copy link
Contributor

vic commented Nov 6, 2019

@tutume You are looking for asdf-direnv then.

@tutume
Copy link

tutume commented Nov 8, 2019

@tutume You are looking for asdf-direnv then.

Thanks. Gonna have a look.

@akostadinov
Copy link

Maybe reshim automatically after bundle and gem commands are run. Perhaps with install, uninstall (gem only), update sub-commands.

@jtzero
Copy link

jtzero commented Sep 24, 2021

I added this and it seems to work

--- a/lib/commands/command-exec.bash
+++ b/lib/commands/command-exec.bash
@@ -25,6 +25,7 @@ shim_exec_command() {
     if [ "$pre_status" -ne 0 ]; then
       return "$pre_status"
     fi
+    { while [[ ! "$(cat /proc/$$/stat | cut -d' ' -f3)" =~ (R|S|I) ]]; do sleep 1; done; asdf_run_hook "post_${plugin_name}_${shim_name}" "${shim_args[@]}"; } &
     exec "$executable_path" "${shim_args[@]}"
   }
# ~/.asdfrc
post_python_pip = ~/.local/bin/post_python_pip ${@}
# ~/.local/bin/post_python_pip
asdf reshim python "$(asdf current python | tr -s ' ' | cut -d' ' -f2)"

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

5 participants