From cad482fd25bf955cb4f8b72821225b8863a9d40f Mon Sep 17 00:00:00 2001 From: coward Date: Thu, 9 May 2024 14:19:33 +0800 Subject: [PATCH] :art: --- command/wireguard.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()) }