Acquires .beads/.linear-sync.lock at start of bd linear sync to serialize concurrent invocations. Stale lock detection via PID check. Clean release on SIGTERM via defer. Prevents duplicate creates and conflict thrash from overlapping sync runs.
16 lines
280 B
Go
16 lines
280 B
Go
//go:build windows
|
|
|
|
package linear
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func isProcessAlive(pid int) bool {
|
|
h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
|
|
if err != nil {
|
|
return false
|
|
}
|
|
windows.CloseHandle(h)
|
|
return true
|
|
}
|