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:
parent
4127396892
commit
80dcfc362b
7
shell.go
7
shell.go
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user