停止节点时systemctl命令不阻塞当前进程

This commit is contained in:
GoEdgeLab
2022-04-26 12:22:00 +08:00
parent 306d697f69
commit adebfb72d5

View File

@@ -217,7 +217,10 @@ func (this *AppCmd) runStop() {
if runtime.GOOS == "linux" { if runtime.GOOS == "linux" {
systemctl, _ := exec.LookPath("systemctl") systemctl, _ := exec.LookPath("systemctl")
if len(systemctl) > 0 { if len(systemctl) > 0 {
_ = exec.Command(systemctl, "stop", teaconst.SystemdServiceName).Run() go func() {
// 有可能会长时间执行,这里不阻塞进程
_ = exec.Command(systemctl, "stop", teaconst.SystemdServiceName).Run()
}()
} }
} }