mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	停止节点时systemctl命令不阻塞当前进程
This commit is contained in:
		@@ -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()
 | 
				
			||||||
 | 
								}()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user