fix: harden pi maintenance lifecycle
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
//go:build windows
|
||||
|
||||
package pi
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
func processAlive(pid int) bool {
|
||||
handle, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
|
||||
if err != nil { return err == windows.ERROR_ACCESS_DENIED }
|
||||
defer windows.CloseHandle(handle)
|
||||
var code uint32
|
||||
if windows.GetExitCodeProcess(handle, &code) != nil { return true }
|
||||
return code == 259 // STILL_ACTIVE
|
||||
}
|
||||
Reference in New Issue
Block a user