Skip to content

Commit

Permalink
fix(scoop-update): Enforce $null array (ScoopInstaller#4725)
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven authored and se35710 committed Mar 8, 2022
1 parent 5b6d126 commit 7386eed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637))
- **versions:** Fix wrong version number when only one version dir ([#4679](https://github.com/ScoopInstaller/Scoop/issues/4679))
- **versions:** Get current version from failed installation if possible ([#4720](https://github.com/ScoopInstaller/Scoop/issues/4720))
- **scoop-update:** Enforce $null array ([#4725](https://github.com/ScoopInstaller/Scoop/issues/4725))
- **scoop-cleanup:** Remove apps other than current version ([#4665](https://github.com/ScoopInstaller/Scoop/issues/4665))
- **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670))
- **scoop-update:** Remove 'Done.' output ([#4672](https://github.com/ScoopInstaller/Scoop/issues/4672))
Expand Down
2 changes: 1 addition & 1 deletion lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ function ensure_none_failed($apps) {
foreach ($global in $true, $false) {
if (failed $app $global) {
if (installed $app $global) {
warn "Repair previous failed installation of $app."
info "Repair previous failed installation of $app."
& "$PSScriptRoot\..\libexec\scoop-reset.ps1" $app$(if ($global) { ' --global' })
} else {
warn "Purging previous failed installation of $app."
Expand Down
12 changes: 7 additions & 5 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,20 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
install_app $app $architecture $global $suggested $use_cache $check_hash
} else {
# Also add missing dependencies
$apps = (Get-Dependency $app $architecture) -ne $app
$apps = @(Get-Dependency $app $architecture) -ne $app
ensure_none_failed $apps
@($apps) + $app | Where-Object { !(installed $_) } | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
$apps.Where({ !(installed $_) }) + $app | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
}
}

if (-not ($apps -or $all)) {
if ($global) {
"scoop update: --global is invalid when <app> is not specified."; exit 1
error 'scoop update: --global is invalid when <app> is not specified.'
exit 1
}
if (!$use_cache) {
"scoop update: --no-cache is invalid when <app> is not specified."; exit 1
error 'scoop update: --no-cache is invalid when <app> is not specified.'
exit 1
}
update_scoop
} else {
Expand Down Expand Up @@ -320,7 +322,7 @@ if (-not ($apps -or $all)) {
}
} elseif ($apps_param -ne '*') {
if ($status.installed) {
ensure_none_failed $app $global
ensure_none_failed $app
Write-Host "$app`: $($status.version) (latest version)" -ForegroundColor Green
} else {
info 'Please reinstall it or fix the manifest.'
Expand Down

0 comments on commit 7386eed

Please sign in to comment.