mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Restart process should use the current process' pid (#7373)
This fixes varying pids for server-respawns. And avoids duplicate process creating multiple pids when the server restart signal is triggered with service restart enabled. Fixes #7350
This commit is contained in:
parent
8e1e701d35
commit
89e45d0695
@ -19,6 +19,7 @@ package cmd
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Type of service signals currently supported.
|
||||
@ -56,9 +57,7 @@ func restartProcess() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Pass on the environment and replace the old count key with the new one.
|
||||
cmd := exec.Command(argv0, os.Args[1:]...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Start()
|
||||
// Invokes the execve system call.
|
||||
// Re-uses the same pid. This preserves the pid over multiple server-respawns.
|
||||
return syscall.Exec(argv0, os.Args, os.Environ())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user