(file string, exts []string)
| 58 | } |
| 59 | |
| 60 | func findExecutable(file string, exts []string) (string, error) { |
| 61 | if len(exts) == 0 { |
| 62 | return file, chkStat(file) |
| 63 | } |
| 64 | if hasExt(file) { |
| 65 | if chkStat(file) == nil { |
| 66 | return file, nil |
| 67 | } |
| 68 | } |
| 69 | for _, e := range exts { |
| 70 | if f := file + e; chkStat(f) == nil { |
| 71 | return f, nil |
| 72 | } |
| 73 | } |
| 74 | return "", os.ErrNotExist |
| 75 | } |
| 76 | |
| 77 | // LookPath searches for an executable named file in the |
| 78 | // directories named by the PATH environment variable. |