MCPcopy Index your code
hub / github.com/cli/safeexec / findExecutable

Function findExecutable

lookpath_windows.go:60–75  ·  view source on GitHub ↗
(file string, exts []string)

Source from the content-addressed store, hash-verified

58}
59
60func 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.

Callers 1

LookPathFunction · 0.85

Calls 2

chkStatFunction · 0.85
hasExtFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…