diff --git a/command/wireguard.go b/command/wireguard.go index b8b81eb..6609d16 100644 --- a/command/wireguard.go +++ b/command/wireguard.go @@ -47,7 +47,7 @@ func RestartWireguard(isAsync bool) { func StopWireguard() { configFileName := getConfigFileName() - if err := exec.Command(fmt.Sprintf("wg-quick down %s", configFileName)).Run(); err != nil { + if err := exec.Command("/bin/sh", "-c", fmt.Sprintf("wg-quick down %s", configFileName)).Run(); err != nil { log.Errorf("停止wireguard服务端失败: %v", err.Error()) } @@ -59,7 +59,7 @@ func StopWireguard() { func StartWireguard() { configFileName := getConfigFileName() - if err := exec.Command(fmt.Sprintf("wg-quick up %s", configFileName)).Run(); err != nil { + if err := exec.Command("/bin/sh", "-c", fmt.Sprintf("wg-quick up %s", configFileName)).Run(); err != nil { log.Errorf("启动wireguard服务端失败: %v", err.Error()) }