fix: harden thothctl Windows safe I/O
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Package testsupport provides portable helpers shared by thothctl tests.
|
||||
package testsupport
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// SymlinkOrSkip creates a symlink or skips only when Windows reports that symlink privilege is
|
||||
// unavailable. All other failures remain test failures.
|
||||
func SymlinkOrSkip(t testing.TB, target, link string) {
|
||||
t.Helper()
|
||||
if err := os.Symlink(target, link); err != nil {
|
||||
if isSymlinkPrivilegeUnavailable(err) {
|
||||
t.Skip("Windows symlink privilege is unavailable")
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user