mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
15 lines
319 B
Go
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
|
|
}
|