Code refactoring after #1168
This commit is contained in:
+1
-11
@@ -45,17 +45,7 @@ func Init() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
ppid := os.Getppid()
|
if daemon && os.Getppid() != 1 {
|
||||||
if ppid == 1 {
|
|
||||||
daemon = false
|
|
||||||
} else {
|
|
||||||
parent, err := os.FindProcess(ppid)
|
|
||||||
if err != nil || parent.Pid < 1 {
|
|
||||||
daemon = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if daemon {
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
fmt.Println("Daemon mode is not supported on Windows")
|
fmt.Println("Daemon mode is not supported on Windows")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user