mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-23 02:04:14 +00:00
29 lines
433 B
Go
29 lines
433 B
Go
// +build !windows
|
|
|
|
package fiber
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
dummyChildCmd = "go"
|
|
)
|
|
|
|
func dummyCmd() *exec.Cmd {
|
|
return exec.Command(dummyChildCmd, "version")
|
|
}
|
|
|
|
// watchMaster gets ppid regularly,
|
|
// if it is equal to 1 (init process ID),
|
|
// it indicates that the master process has exited
|
|
func watchMaster() {
|
|
for range time.NewTicker(time.Millisecond * 500).C {
|
|
if os.Getppid() == 1 {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
}
|