MCPcopy Index your code
hub / github.com/cli/cli / Find

Function Find

pkg/findsh/find_windows.go:10–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8)
9
10func Find() (string, error) {
11 shPath, shErr := safeexec.LookPath("sh")
12 if shErr == nil {
13 return shPath, nil
14 }
15
16 gitPath, err := safeexec.LookPath("git")
17 if err != nil {
18 return "", shErr
19 }
20 gitDir := filepath.Dir(gitPath)
21
22 // regular Git for Windows install
23 shPath = filepath.Join(gitDir, "..", "bin", "sh.exe")
24 if _, err := os.Stat(shPath); err == nil {
25 return filepath.Clean(shPath), nil
26 }
27
28 // git as a scoop shim
29 shPath = filepath.Join(gitDir, "..", "apps", "git", "current", "bin", "sh.exe")
30 if _, err := os.Stat(shPath); err == nil {
31 return filepath.Clean(shPath), nil
32 }
33
34 return "", shErr
35}

Callers

nothing calls this directly

Calls 2

JoinMethod · 0.80
CleanMethod · 0.45

Tested by

no test coverage detected