MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / readGitExecPath

Function readGitExecPath

packages/kaos/src/environment.ts:155–171  ·  view source on GitHub ↗
(
  deps: EnvironmentDeps,
  gitExe: string,
)

Source from the content-addressed store, hash-verified

153}
154
155async function readGitExecPath(
156 deps: EnvironmentDeps,
157 gitExe: string,
158): Promise<string | undefined> {
159 if (deps.platform === 'win32' && !isAbsoluteWindowsPath(gitExe)) return undefined;
160
161 const stdout = await deps.execFileText(gitExe, ['--exec-path'], GIT_EXEC_PATH_TIMEOUT_MS);
162 if (stdout === undefined) return undefined;
163
164 for (const line of stdout.split(/\r?\n/)) {
165 const execPath = line.trim();
166 if (execPath.length > 0) {
167 return execPath;
168 }
169 }
170 return undefined;
171}
172
173// Most Git for Windows installs put `git.exe` in `<root>\cmd\git.exe`,
174// with bash at `<root>\bin\bash.exe`. Portable installs sometimes put

Callers 1

locateWindowsGitBashFunction · 0.85

Calls 1

isAbsoluteWindowsPathFunction · 0.85

Tested by

no test coverage detected