Skip to content

Commit 92b71eb

Browse files
committed
fix(smoke): use @() array coercion for empty PATH entries count
$entries4 is a 0-element array which PowerShell can coerce to $null in some contexts, causing '$entries4.Count' to throw ParentContainsErrorRecordException. $(@entries4).Count forces array coercion so .Count always works.
1 parent 097639e commit 92b71eb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/smoke/install-smoke.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ try {
188188
$entries4 = if ([string]::IsNullOrEmpty($fakePath4)) { @() } else {
189189
$fakePath4 -split ';' | ForEach-Object { $_.TrimEnd('\') }
190190
}
191-
if ($entries4.Count -eq 0) {
191+
if (@($entries4).Count -eq 0) {
192192
Pass "PATH logic: null User PATH treated as empty"
193193
} else {
194194
Fail "PATH logic: null User PATH not handled"

0 commit comments

Comments
 (0)