Fix Windows CI test failures (bd-99)

- Fix PID detection: Open lock file with O_RDWR for Windows LockFileEx
- Fix script tests: Increase timeout to 2-5s for Windows process startup
- Fix uptime test: Use math.Ceil with minimum 1 second to prevent flakiness
- Fix socket cleanup: Add done channel to wait for Start() cleanup completion

All 5 failing Windows tests should now pass.
This commit is contained in:
Steve Yegge
2025-10-24 10:07:05 -07:00
parent 58ea4548fa
commit 09e51b2184
5 changed files with 49 additions and 9 deletions

View File

@@ -24,8 +24,13 @@ func TestScripts(t *testing.T) {
}
// Create minimal engine with default commands plus bd
// Use longer timeout on Windows for slower process startup and I/O
timeout := 2 * time.Second
if runtime.GOOS == "windows" {
timeout = 5 * time.Second
}
engine := script.NewEngine()
engine.Cmds["bd"] = script.Program(exe, nil, 100*time.Millisecond)
engine.Cmds["bd"] = script.Program(exe, nil, timeout)
// Run all tests
scripttest.Test(t, context.Background(), engine, nil, "testdata/*.txt")