halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
460 stars 85 forks source link

Update set-java-home.xsh #216

Open nd-net opened 11 months ago

nd-net commented 11 months ago

The process substitution operator $() returns output with universal new lines which must be stripped - $(asdf which java) returns the path name including a trailing \n; feeding that to realpath gives the error message "No such file or directory".

Replaced the temporary environment variable $java_path with a local java variable java_path (without the $), the variable automatically gets discarded at the end of the scope and does not need an explicit del.

Replaced if len(java_path) > 0 by the equivalent but more pythonic if java_path.