Files
v2rayA/service/tools/command.go
T

15 lines
319 B
Go

package tools
import (
"bytes"
"os/exec"
)
func IsCommandValid(command string) bool {
out, err := exec.Command("sh", "-c", "type '"+command+"'").CombinedOutput()
if err != nil {
out, err = exec.Command("sh", "-c", "which '"+command+"'").CombinedOutput()
}
return err == nil && len(bytes.TrimSpace(out)) > 0
}