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

Function applyLoginShellPath

packages/kaos/src/login-shell-path.ts:116–126  ·  view source on GitHub ↗
(deps: LoginShellPathDeps)

Source from the content-addressed store, hash-verified

114
115/** Probe the login shell and merge its PATH into `deps.env['PATH']`. */
116export async function applyLoginShellPath(deps: LoginShellPathDeps): Promise<void> {
117 const loginShellPath = await probeLoginShellPath(deps);
118 if (loginShellPath === undefined) return;
119 const currentPath = deps.env['PATH'];
120 const merged = mergeLoginShellPath(currentPath, loginShellPath);
121 // Only write when something was appended — an unset PATH must stay
122 // unset (assigning '' would turn "implementation default search path"
123 // into "cwd-only lookup"), and a set PATH must not be rewritten.
124 if (merged === (currentPath ?? '')) return;
125 deps.env['PATH'] = merged;
126}
127
128/**
129 * Production convenience — apply the probe to `process.env` once per

Callers 2

Calls 2

probeLoginShellPathFunction · 0.85
mergeLoginShellPathFunction · 0.85

Tested by

no test coverage detected