(deps: LoginShellPathDeps)
| 114 | |
| 115 | /** Probe the login shell and merge its PATH into `deps.env['PATH']`. */ |
| 116 | export 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 |
no test coverage detected