Open coder543 opened 4 years ago
Silencing an error within a "framework" because you get it, is not a great idea. It would be better to solve the root cause of the problem, iff everyone was getting this error. i.e. don't attempt to do anything with the java executable if it's not installed.
This PR has the potential to silence other errors that are not relevant to global java, and using asdf which java
to find out where the installed version of java is implies that asdf java is installed, which hasn't been confirmed. We need to confirm that asdf java is installed prior to any attempt at finding the assumed executable's path.
The check for an installed asdf java is not being done, which is the root cause of this error that needs fixed, which is really easy:
if asdf list java &>/dev/null | grep -v "No versions installed" &>/dev/null; then
echo "asdf java is installed" # now check for the path..
else
echo "asdf java is not installed" # prevent any & all asdf-java plugin logic that requires a java binary
fi
Whatever you may suspect, no tool installed into an environment should ever generate an error every time completely unrelated commands are executed. I followed the instructions available at the time. None of this left me with positive feelings towards asdf
.
If someone had asked me a year ago(!), I could probably have done some troubleshooting with someone to find a better root cause. As it is, I did what I could to make this tool work better.
Whatever you may suspect, no tool installed into an environment should ever generate an error every time completely unrelated commands are executed. I followed the instructions available at the time.
If someone had asked me a year ago(!), I could probably have done some troubleshooting with someone to find a better root cause. As it is, I did what I could to make this tool work better.
I hear you. I didn't mean to come off as aggressive as I did. I updated the comment with the appropriate fix and explanation.
Whatever you may suspect, no tool installed into an environment should ever generate an error every time completely unrelated commands are executed. I followed the instructions available at the time. None of this left me with positive feelings towards asdf.
And more to this point, asdf itself has a feature-void in that it's allowing a plugin to execute arbitrary code without any sort of dependency support. Ideally, asdf would prevent plugins from executing for all unrelated commands unless it absolutely needs to.
And this plugin executing every time other commands are run is extremely inefficient and should itself be considered a bug. this could be fixed easily with a flag that is only set when a java binary is available (enabled on first java version install, disabled on last java binary uninstall)
After every single command, I've been getting this error:
unknown command: java. Perhaps you have to reshim?
etc.
After looking at the hook, I decided to redirect error output to
/dev/null
, and that seems to have resolved this issue for me. So, I figured I would mention this here in case anyone is interested in merging this fix, or if anyone sees a problem with this approach.