From 568740ed17547cb8add94985291168663f84cd9d Mon Sep 17 00:00:00 2001 From: Simone Date: Sat, 23 May 2026 22:41:28 +0200 Subject: [PATCH] fix(burn-in): move psExe detection inside Start-Job scriptblock Passing $psExe as a second -ArgumentList item caused double-wrapping of the string array, collapsing all args into one string when splatted. Computing $IsWindows inside the worker avoids the extra param entirely. Co-Authored-By: Claude Sonnet 4.6 --- scripts/Test-CapacityBurnIn.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/Test-CapacityBurnIn.ps1 b/scripts/Test-CapacityBurnIn.ps1 index 1113ec3..a364870 100644 --- a/scripts/Test-CapacityBurnIn.ps1 +++ b/scripts/Test-CapacityBurnIn.ps1 @@ -216,18 +216,19 @@ for ($r = 1; $r -le $Rounds; $r++) { # Start-Job runs a new PS session; call the platform PS executable as child # process so exit $exitCode from Invoke-CIJob.ps1 is captured in $LASTEXITCODE. + # $IsWindows is evaluated inside the job worker (correct OS context). # NOTE: do NOT name the parameter $Args — @Args is a PS reserved splatting # alias for the automatic $Args variable (unbound arguments), which would # be empty here since the parameter binding consumed all positional args. - $psExe = if ($IsWindows) { 'powershell.exe' } else { 'pwsh' } $psJob = Start-Job -ScriptBlock { - param([string[]]$ChildArgs, [string]$PsExe) - $out = & $PsExe @ChildArgs 2>&1 + param([string[]]$ChildArgs) + $psExe = if ($IsWindows) { 'powershell.exe' } else { 'pwsh' } + $out = & $psExe @ChildArgs 2>&1 [PSCustomObject]@{ ExitCode = $LASTEXITCODE Output = ($out -join "`n") } - } -ArgumentList (, $argArray), $psExe + } -ArgumentList (, $argArray) $jobEntries.Add(@{ PSJob = $psJob