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(scoop-update): Enforce $null array #4725

Merged
merged 2 commits into from
Feb 9, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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