mirror of
https://github.com/minio/minio.git
synced 2025-07-08 08:32:18 -04:00
support 'mc admin service restart' for windows (#16512)
This commit is contained in:
parent
cdb1b48ad9
commit
a91f353621
@ -21,6 +21,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,6 +57,19 @@ func initGlobalContext() {
|
|||||||
// deployed binary to be started. It returns the pid of the newly started
|
// deployed binary to be started. It returns the pid of the newly started
|
||||||
// process when successful.
|
// process when successful.
|
||||||
func restartProcess() error {
|
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
|
// 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.
|
// the file it points to has been changed we will use the updated symlink.
|
||||||
argv0, err := exec.LookPath(os.Args[0])
|
argv0, err := exec.LookPath(os.Args[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user