Skip to content

Commit c01960f

Browse files
authored
fix(scoop-update): Enforce $null array (#4725)
1 parent 285ffd0 commit c01960f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637))
2626
- **versions:** Fix wrong version number when only one version dir ([#4679](https://github.com/ScoopInstaller/Scoop/issues/4679))
2727
- **versions:** Get current version from failed installation if possible ([#4720](https://github.com/ScoopInstaller/Scoop/issues/4720))
28+
- **scoop-update:** Enforce $null array ([#4725](https://github.com/ScoopInstaller/Scoop/issues/4725))
2829
- **scoop-cleanup:** Remove apps other than current version ([#4665](https://github.com/ScoopInstaller/Scoop/issues/4665))
2930
- **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670))
3031
- **scoop-update:** Remove 'Done.' output ([#4672](https://github.com/ScoopInstaller/Scoop/issues/4672))

lib/install.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ function ensure_none_failed($apps) {
10751075
foreach ($global in $true, $false) {
10761076
if (failed $app $global) {
10771077
if (installed $app $global) {
1078-
warn "Repair previous failed installation of $app."
1078+
info "Repair previous failed installation of $app."
10791079
& "$PSScriptRoot\..\libexec\scoop-reset.ps1" $app$(if ($global) { ' --global' })
10801080
} else {
10811081
warn "Purging previous failed installation of $app."

libexec/scoop-update.ps1

+7-5
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,20 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
274274
install_app $app $architecture $global $suggested $use_cache $check_hash
275275
} else {
276276
# Also add missing dependencies
277-
$apps = (Get-Dependency $app $architecture) -ne $app
277+
$apps = @(Get-Dependency $app $architecture) -ne $app
278278
ensure_none_failed $apps
279-
@($apps) + $app | Where-Object { !(installed $_) } | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
279+
$apps.Where({ !(installed $_) }) + $app | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
280280
}
281281
}
282282

283283
if (-not ($apps -or $all)) {
284284
if ($global) {
285-
"scoop update: --global is invalid when <app> is not specified."; exit 1
285+
error 'scoop update: --global is invalid when <app> is not specified.'
286+
exit 1
286287
}
287288
if (!$use_cache) {
288-
"scoop update: --no-cache is invalid when <app> is not specified."; exit 1
289+
error 'scoop update: --no-cache is invalid when <app> is not specified.'
290+
exit 1
289291
}
290292
update_scoop
291293
} else {
@@ -320,7 +322,7 @@ if (-not ($apps -or $all)) {
320322
}
321323
} elseif ($apps_param -ne '*') {
322324
if ($status.installed) {
323-
ensure_none_failed $app $global
325+
ensure_none_failed $app
324326
Write-Host "$app`: $($status.version) (latest version)" -ForegroundColor Green
325327
} else {
326328
info 'Please reinstall it or fix the manifest.'

0 commit comments

Comments
 (0)