Skip to content

Commit 51c1555

Browse files
committed
fix: improve Windows error diagnostics with DLL dependency check
- Use Start-Process to properly capture exit codes - Detect 0xC0000139 (STATUS_ENTRYPOINT_NOT_FOUND) error - Locate and run dumpbin to show DLL dependencies - Display system PATH for debugging
1 parent a3f00e0 commit 51c1555

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,40 @@ jobs:
6767
6868
# Try to run with error capture
6969
try {
70-
$output = & cjbind --version 2>&1
71-
Write-Host "Output: $output"
72-
if ($LASTEXITCODE -ne 0) {
73-
Write-Host "ERROR: Exit code $LASTEXITCODE"
74-
Write-Host "Checking dependencies with dumpbin..."
75-
if (Get-Command dumpbin -ErrorAction SilentlyContinue) {
76-
dumpbin /dependents "$env:USERPROFILE\.cjpm\bin\cjbind.exe"
70+
$process = Start-Process -FilePath "cjbind" -ArgumentList "--version" -NoNewWindow -PassThru -Wait -RedirectStandardOutput "stdout.txt" -RedirectStandardError "stderr.txt"
71+
72+
Write-Host "`n=== STDOUT ==="
73+
if (Test-Path "stdout.txt") { Get-Content "stdout.txt" }
74+
75+
Write-Host "`n=== STDERR ==="
76+
if (Test-Path "stderr.txt") { Get-Content "stderr.txt" }
77+
78+
Write-Host "`n=== Exit Code: $($process.ExitCode) ==="
79+
80+
if ($process.ExitCode -eq -1073741511) {
81+
Write-Host "`nERROR 0xC0000139: STATUS_ENTRYPOINT_NOT_FOUND"
82+
Write-Host "This means a required DLL is missing or incompatible.`n"
83+
84+
Write-Host "Attempting to check dependencies..."
85+
86+
# Try dumpbin
87+
$dumpbinPath = "${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe"
88+
$dumpbin = Get-Item $dumpbinPath -ErrorAction SilentlyContinue | Select-Object -First 1
89+
90+
if ($dumpbin) {
91+
Write-Host "`n=== DLL Dependencies (dumpbin) ==="
92+
& $dumpbin.FullName /dependents "$env:USERPROFILE\.cjpm\bin\cjbind.exe"
93+
} else {
94+
Write-Host "dumpbin not found"
7795
}
78-
exit $LASTEXITCODE
96+
97+
Write-Host "`n=== System PATH ==="
98+
$env:PATH -split ';' | ForEach-Object { Write-Host " $_" }
99+
100+
exit 1
101+
} elseif ($process.ExitCode -ne 0) {
102+
Write-Host "ERROR: Non-zero exit code"
103+
exit $process.ExitCode
79104
}
80105
} catch {
81106
Write-Host "EXCEPTION: $_"

0 commit comments

Comments
 (0)