mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-12 09:34:05 +08:00
28 lines
542 B
Go
28 lines
542 B
Go
//go:build !darwin && !linux && !windows
|
|
|
|
package nativewindow
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type genericDetachedParentWatcher struct {
|
|
pid int
|
|
}
|
|
|
|
func newDetachedParentWatcher(pid int) (detachedParentWatcher, error) {
|
|
if pid <= 1 {
|
|
return nil, fmt.Errorf("invalid detached parent process ID: %d", pid)
|
|
}
|
|
return &genericDetachedParentWatcher{pid: pid}, nil
|
|
}
|
|
|
|
func (w *genericDetachedParentWatcher) Alive() (bool, error) {
|
|
return w != nil && os.Getppid() == w.pid, nil
|
|
}
|
|
|
|
func (*genericDetachedParentWatcher) Close() error {
|
|
return nil
|
|
}
|