Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wait until the plugin update are finished #1037

Merged
merged 1 commit into from Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/commands/command-plugin-update.bash
Expand Up @@ -8,12 +8,14 @@ plugin_update_command() {

local plugin_name="$1"
local gitref="${2}"
local plugins=

if [ "$plugin_name" = "--all" ]; then
if [ -d "$(asdf_data_dir)"/plugins ]; then
find "$(asdf_data_dir)"/plugins -mindepth 1 -maxdepth 1 -type d | while IFS= read -r dir; do
plugins=$(find "$(asdf_data_dir)"/plugins -mindepth 1 -maxdepth 1 -type d)
while IFS= read -r dir; do
update_plugin "$(basename "$dir")" "$dir" "$gitref" &
done
done <<<"$plugins"
wait
fi
else
Expand Down
7 changes: 7 additions & 0 deletions test/plugin_update_command.bats
Expand Up @@ -112,3 +112,10 @@ teardown() {
[ "$status" -eq 0 ]
[ -f $ASDF_DIR/shims/dummy ]
}

@test "asdf plugin-update done for all plugins" {
local command="asdf plugin-update --all"
# Count the number of update processes remaining after the update command is completed.
run bash -c "${command} >/dev/null && ps -o 'ppid,args' | awk '{if(\$1==1 && \$0 ~ /${command}/ ) print}' | wc -l"
[[ 0 -eq "$output" ]]
}