Skip to content

Commit 5ad3beb

Browse files
Address review: keep already-installed status semantics when nothing matches
Normalize the already-installed set to \ when the (prerelease-filtered) query returns nothing, so the '-not' install guard and the '\ -ne' moduleStatus check both retain their original meaning instead of an empty array reading as 'installed'.
1 parent a6d0a87 commit 5ad3beb

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/init.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ process {
3939
# otherwise installation is skipped and resolution later fails with only a prerelease present.
4040
$alreadyInstalled = @($alreadyInstalled | Where-Object { [string]::IsNullOrWhiteSpace($_.Prerelease) })
4141
}
42+
# Normalize to $null when nothing matches so the '-not' install guard and the '$null -ne' status
43+
# check below both keep their original semantics (an empty array is not $null).
44+
if ($alreadyInstalled.Count -eq 0) {
45+
$alreadyInstalled = $null
46+
}
4247

4348
if ($showInit) {
4449
Write-Output 'Already installed:'

0 commit comments

Comments
 (0)