Files
Local-Cursor/internal/backend/forwarder/process_exists_windows.go

19 lines
346 B
Go
Raw Normal View History

//go:build windows
package forwarder
import (
"errors"
"golang.org/x/sys/windows"
)
func processExists(pid int) bool {
handle, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
if err == nil {
_ = windows.CloseHandle(handle)
return true
}
return errors.Is(err, windows.ERROR_ACCESS_DENIED)
}