Harden Harness runtime, persistence and execution for Hand

This commit is contained in:
sausheong committed 2026-09-09 22:55:55 +08:00
1 parent 09c30fe2d5
commit 0972eed3ea
164 files changed
+15912 -506

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
//go:build unix
package process
import (
"errors"
"os"
"syscall"
)
func lockArtifact(f *os.File, nonblocking bool) error {
flags := syscall.LOCK_EX
if nonblocking {
flags |= syscall.LOCK_NB
}
return syscall.Flock(int(f.Fd()), flags)
}
func artifactBusy(err error) bool { return errors.Is(err, syscall.EWOULDBLOCK) }
func artifactReadFlags() int { return os.O_RDONLY | syscall.O_NONBLOCK | syscall.O_NOFOLLOW }