halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
468 stars 87 forks source link

Use a temp work dir when installing #2

Closed mig4 closed 5 years ago

mig4 commented 5 years ago

Create and automatically clean-up a temporary directory.

This makes the process compliant with asdf requirements to avoid writing to ASDF_INSTALL_PATH until the download, extraction and build are done to avoid racing with other processes trying to access the JDK. https://github.com/asdf-vm/asdf/blob/master/docs/creating-plugins.md#bininstall

Since the directory is automatically cleaned up on exit, functions that extract the archives don't need to worry about cleaning up individual files as long as they are written to the working directory.

Also fix a problem with word splitting of versionstr - if unquoted, the value is split by the shell before passing it to read which meant that distro was actually being assigned DISTRO SPACE VERSION and version was an empty string, it only worked further down coincidentally because the variables weren't quoted so distro was subject to word splitting before being passed to get_java and unpack_java.

x80486 commented 5 years ago

OK, I tested it again and I can't find any issue(s)...I think we can merge this one :sunglasses:

halcyon commented 5 years ago

Thank you @mig4 and @x80486. Will merge ASAP. My apologies for the wait, I was missing notifications from github.

halcyon commented 5 years ago

@mig4 and @x80486 Could I trouble you guys to help me test #6? Thank you!

halcyon commented 5 years ago

Resolved in #6