asdf-vm/asdf

Allow running tools from one another without passing `ASDF_DATA_DIR` around

romeovs opened this issue · 0 comments

Is your feature request related to a problem? Please describe

I'm using asdf for most of my development work.

I'm currently working on a job where test runners spawn each other.
Our nodejs test runner starts up a java server for example,
with an empty env, except for PATH.

I've got all tools set up in .tool-versions.

When calling java from nodejs the error is:

unknown command: java. Perhaps you have to reshim?

This can be fixed by adding ASDF_DATA_DIR to the env in the nodejs code that
spawns java.

Is there a way of avoiding this, I don't want to force my package manager on the project.

I've set up a reproduction repo here.

Describe the proposed solution

Could the shims for the all current .tool-version be references in the PATH variable set when called a tool is called?

For example: in the reproduction repo I set up, golang gets the following items in it's PATH (that are not coming from my shell environment):

/Users/romeo/.asdf/installs/golang/1.21.6/go/bin
/Users/romeo/.asdf/installs/golang/1.21.6/packages/bin

Could this also include the node installs?

Describe similar asdf features and why they are not sufficient

None come to mind.

Describe other workarounds you've considered

Adding the ASDF_DATA_DIR environment variable to the spawn call works, but forces the code to know about asdf which I would like to avoid.