File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -45,22 +45,16 @@ func Init() {
4545 os .Exit (0 )
4646 }
4747
48- if daemon {
48+ if daemon && os . Getppid () != 1 {
4949 if runtime .GOOS == "windows" {
50- fmt .Println ("Daemon not supported on Windows" )
50+ fmt .Println ("Daemon mode is not supported on Windows" )
5151 os .Exit (1 )
5252 }
5353
54- args := os .Args [1 :]
55- for i , arg := range args {
56- if arg == "-daemon" || arg == "-d" {
57- args [i ] = ""
58- }
59- }
6054 // Re-run the program in background and exit
61- cmd := exec .Command (os .Args [0 ], args ... )
55+ cmd := exec .Command (os .Args [0 ], os . Args [ 1 :] ... )
6256 if err := cmd .Start (); err != nil {
63- fmt .Println (err )
57+ fmt .Println ("Failed to start daemon:" , err )
6458 os .Exit (1 )
6559 }
6660 fmt .Println ("Running in daemon mode with PID:" , cmd .Process .Pid )
You can’t perform that action at this time.
0 commit comments