Skip to content

Commit 46b1add

Browse files
committed
ci(windows): convert MCPP_SELF MSYS path → Windows path; rename pwsh $Args
Two issues with the regression step from the previous commit (both showed up only on the actual Windows runner, not in local validation): 1. MCPP_SELF was set in an earlier bash step via `pwd` (git-bash) so the value is MSYS-style (e.g. /d/a/mcpp/...). Bash steps tolerate it but pwsh's `&` operator can't exec it ("not recognized as a name of a cmdlet, function, script file, or executable program"). Convert via cygpath -w before use. 2. `$Args` is a PowerShell automatic variable inside function scope; a `param([string]$Args)` does not bind cleanly. Renamed to $McppArgs to avoid the collision (also updated call sites).
1 parent b5f2508 commit 46b1add

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/ci-windows.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,28 @@ jobs:
103103
run: |
104104
$ErrorActionPreference = 'Stop'
105105
106+
# MCPP_SELF was set in a bash step as an MSYS-style path
107+
# (e.g. /d/a/mcpp/...). PowerShell can't exec that — convert it
108+
# to a native Windows path via the git-bash cygpath that ships
109+
# on the runner.
110+
$mcppExe = (& 'C:\Program Files\Git\usr\bin\cygpath.exe' -w $env:MCPP_SELF).Trim()
111+
Write-Host "Resolved MCPP_SELF (Windows form): $mcppExe"
112+
if (-not (Test-Path $mcppExe)) {
113+
throw "MCPP_SELF after cygpath not found: $mcppExe"
114+
}
115+
106116
$tmp = Join-Path $env:RUNNER_TEMP ("stdin-hang-test-" + [guid]::NewGuid().ToString('N'))
107117
New-Item -ItemType Directory -Path $tmp | Out-Null
108118
Set-Location $tmp
109-
& $env:MCPP_SELF new hello_stdin
119+
& $mcppExe new hello_stdin
110120
Set-Location hello_stdin
111121
112122
function Invoke-McppWithOpenStdin {
113-
param([string]$Args, [int]$TimeoutSeconds = 300)
123+
param([string]$McppPath, [string]$McppArgs, [int]$TimeoutSeconds = 300)
114124
115125
$psi = [System.Diagnostics.ProcessStartInfo]::new()
116-
$psi.FileName = $env:MCPP_SELF
117-
$psi.Arguments = $Args
126+
$psi.FileName = $McppPath
127+
$psi.Arguments = $McppArgs
118128
$psi.WorkingDirectory = (Get-Location).Path
119129
$psi.UseShellExecute = $false
120130
$psi.RedirectStandardInput = $true # parent holds child's stdin
@@ -142,7 +152,7 @@ jobs:
142152
Write-Host $stdoutTask.Result
143153
Write-Host "----- captured stderr -----"
144154
Write-Host $stderrTask.Result
145-
throw "REGRESSION: 'mcpp $Args' HUNG with open-empty stdin after ${TimeoutSeconds}s. The Windows seal_stdin fix is not effective."
155+
throw "REGRESSION: 'mcpp $McppArgs' HUNG with open-empty stdin after ${TimeoutSeconds}s. The Windows seal_stdin fix is not effective."
146156
}
147157
148158
Write-Host "----- stdout -----"
@@ -151,18 +161,18 @@ jobs:
151161
Write-Host $stderrTask.Result
152162
153163
if ($p.ExitCode -ne 0) {
154-
throw "'mcpp $Args' exited with code $($p.ExitCode) (no hang, but failed)."
164+
throw "'mcpp $McppArgs' exited with code $($p.ExitCode) (no hang, but failed)."
155165
}
156166
}
157167
158168
Write-Host '=== T1: mcpp --version (sanity, fast path) ==='
159-
Invoke-McppWithOpenStdin -Args '--version' -TimeoutSeconds 30
169+
Invoke-McppWithOpenStdin -McppPath $mcppExe -McppArgs '--version' -TimeoutSeconds 30
160170
161171
Write-Host '=== T2: mcpp build (full bootstrap + toolchain + dep resolve + compile) ==='
162-
Invoke-McppWithOpenStdin -Args 'build' -TimeoutSeconds 600
172+
Invoke-McppWithOpenStdin -McppPath $mcppExe -McppArgs 'build' -TimeoutSeconds 600
163173
164174
Write-Host '=== T3: mcpp run (post-build run path) ==='
165-
Invoke-McppWithOpenStdin -Args 'run' -TimeoutSeconds 120
175+
Invoke-McppWithOpenStdin -McppPath $mcppExe -McppArgs 'run' -TimeoutSeconds 120
166176
167177
Write-Host 'SUCCESS: mcpp completes with open-empty stdin → Windows seal_stdin fix verified.'
168178

0 commit comments

Comments
 (0)