mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
support 'mc admin service restart' for windows (#16512)
This commit is contained in:
parent
cdb1b48ad9
commit
a91f353621
@ -21,6 +21,7 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@ -56,6 +57,19 @@ func initGlobalContext() {
|
||||
// deployed binary to be started. It returns the pid of the newly started
|
||||
// process when successful.
|
||||
func restartProcess() error {
|
||||
if runtime.GOOS == globalWindowsOSName {
|
||||
cmd := exec.Command(os.Args[0], os.Args[1:]...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Env = os.Environ()
|
||||
err := cmd.Run()
|
||||
if err == nil {
|
||||
os.Exit(0)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Use the original binary location. This works with symlinks such that if
|
||||
// the file it points to has been changed we will use the updated symlink.
|
||||
argv0, err := exec.LookPath(os.Args[0])
|
||||
|
Loading…
Reference in New Issue
Block a user