mirror of https://github.com/Hilbis/Hilbish
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
|
// custom lookpath function so we know if a command is found *and* has execute permission
|
||||||
func lookpath(file string) error {
|
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")) {
|
for _, dir := range filepath.SplitList(os.Getenv("PATH")) {
|
||||||
path := filepath.Join(dir, file)
|
path := filepath.Join(dir, file)
|
||||||
err := findExecutable(path)
|
err := findExecutable(path)
|
||||||
|
|
Loading…
Reference in New Issue