2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-01 19:23:24 +00:00

fix: allow non absolute paths to be executed

this is a regression introduced in 06272778f85dad04e0e7abffc78a5b9b0cebd067
This commit is contained in:
TorchedSammy 2021-11-22 22:49:23 -05:00
parent 4127396892
commit 80dcfc362b
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -166,6 +166,13 @@ func execCommand(cmd string) error {
// custom lookpath function so we know if a command is found *and* has execute permission
func lookpath(file string) error {
skip := []string{"./", "/", "../", "~/"}
for _, s := range skip {
if strings.HasPrefix(file, s) {
err := findExecutable(file)
return err
}
}
for _, dir := range filepath.SplitList(os.Getenv("PATH")) {
path := filepath.Join(dir, file)
err := findExecutable(path)