File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 77 "os/exec"
88 "runtime"
99 "runtime/debug"
10- "syscall"
1110)
1211
1312var (
@@ -46,25 +45,26 @@ func Init() {
4645 os .Exit (0 )
4746 }
4847
49- if os .Getppid () == 1 || syscall .Getppid () == 1 {
48+ ppid := os .Getppid ()
49+ if ppid == 1 {
5050 daemon = false
5151 } else {
52- parent , err := os .FindProcess (os . Getppid () )
52+ parent , err := os .FindProcess (ppid )
5353 if err != nil || parent .Pid < 1 {
5454 daemon = false
5555 }
5656 }
5757
5858 if daemon {
5959 if runtime .GOOS == "windows" {
60- fmt .Println ("Daemon not supported on Windows" )
60+ fmt .Println ("Daemon mode is not supported on Windows" )
6161 os .Exit (1 )
6262 }
6363
6464 // Re-run the program in background and exit
6565 cmd := exec .Command (os .Args [0 ], os .Args [1 :]... )
6666 if err := cmd .Start (); err != nil {
67- fmt .Println (err )
67+ fmt .Println ("Failed to start daemon:" , err )
6868 os .Exit (1 )
6969 }
7070 fmt .Println ("Running in daemon mode with PID:" , cmd .Process .Pid )
You can’t perform that action at this time.
0 commit comments