试用 executils.LookPath()代替 exec.LookPath()

This commit is contained in:
GoEdgeLab
2023-07-05 11:34:52 +08:00
parent 2ccd0db52f
commit 0c81fd5090
2 changed files with 9 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ package utils
import (
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
executils "github.com/TeaOSLab/EdgeAPI/internal/utils/exec"
"github.com/iwind/TeaGo/types"
"os/exec"
"runtime"
@@ -14,7 +15,7 @@ func AddPortsToFirewall(ports []int) {
// Linux
if runtime.GOOS == "linux" {
// firewalld
firewallCmd, _ := exec.LookPath("firewall-cmd")
firewallCmd, _ := executils.LookPath("firewall-cmd")
if len(firewallCmd) > 0 {
err := exec.Command(firewallCmd, "--add-port="+types.String(port)+"/tcp").Run()
if err == nil {