Skip to content

Fix plugin-update --all when there are no plugins#803

Merged
Stratus3D merged 1 commit intoasdf-vm:masterfrom
joelparkerhenderson:patch-1
Sep 18, 2020
Merged

Fix plugin-update --all when there are no plugins#803
Stratus3D merged 1 commit intoasdf-vm:masterfrom
joelparkerhenderson:patch-1

Conversation

@joelparkerhenderson
Copy link
Contributor

Issue: when asdf is first installed, there are no plugins, and running asdf plugin-update --all crashes because the plugin directory doesn't exist; similarly, the command crashes if the plugins directory exists yet doesn't contain any subdirectories.

Solution: This patch changes the directory loop from using a wildcard plugins/* to a more robust approach: first verify the plugins directory exists, then use thefind command to list subdirectories and correctly handle the corner case of no subdirectories.

Future: Consider printing an error message and/or advice message. Consider automatically creating the plugins directory as needed. Consider prompting the user to install some popular plugins.

Summary

Provide a general description of the code changes in your pull request.

Fixes: List issue numbers here

Other Information

If there is anything else that is relevant to your pull request include that
information here.

Thank you for contributing to asdf!

Issue: when asdf is first installed, there are no plugins, and running `asdf plugin-update --all` crashes because the plugin directory doesn't exist; similarly, the command crashes if the plugins directory exists yet doesn't contain any subdirectories.

Solution: This patch changes the directory loop from using a wildcard `plugins/*` to a more robust approach: first verify the plugins directory exists, then use the`find` command to list subdirectories and correctly handle the corner case of no subdirectories.

Future: Consider printing an error message and/or advice message. Consider automatically creating the plugins directory as needed. Consider prompting the user to install some popular plugins.
@joelparkerhenderson joelparkerhenderson requested a review from a team as a code owner September 17, 2020 04:01
(cd "$dir" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref")
done
if [ -d "$(asdf_data_dir)"/plugins ]; then
for dir in $(find "$(asdf_data_dir)"/plugins -type d -mindepth 1 -maxdepth 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the do keyword on this line.

@jthegedus jthegedus added the bug label Sep 18, 2020
@Stratus3D Stratus3D merged commit 0efc04b into asdf-vm:master Sep 18, 2020
@Stratus3D
Copy link
Member

Thanks for the PR! I have addressed the syntax errors and merged your changes into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants