test: add resumable isolated test harness

This commit is contained in:
2026-08-31 08:32:23 +00:00
parent 31a1314470
commit d6d93f3d98
11 changed files with 837 additions and 19 deletions
+19
View File
@@ -0,0 +1,19 @@
//go:build windows
package main
import (
"fmt"
"os"
)
func acquireLock(path string) (func(), error) {
file, err := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0o600)
if err != nil {
return nil, fmt.Errorf("another test harness process may hold %s: %w", path, err)
}
return func() {
_ = file.Close()
_ = os.Remove(path)
}, nil
}