Recover working local forge CLIs behind broken PATH launchers

Recover a working local forge CLI when an earlier PATH launcher is broken. Bound executable probes and reuse the verified selection for native operations without replaying authentication or user requests.

Fixes #22975

Co-authored-by: Aashish <145881415+aashish254@users.noreply.github.com>
This commit is contained in:
Aashish Mahato
2026-10-03 20:45:52 -07:00
committed by GitHub
parent 94f5669228
commit e5ba5975df
15 changed files with 1391 additions and 53 deletions
@@ -2,6 +2,7 @@ import { execFile, type ChildProcess, type ExecFileOptions } from 'node:child_pr
import { recordSubprocessSpawn } from '../../diagnostics/main-thread-churn-probe'
import { endSubprocessStdin } from '../../../shared/subprocess-stdin-write'
import { runProcess } from '../../../shared/child-process/run-process'
import { resolveSelectedLocalCommand } from '../../ipc/command-path-resolver'
import type { WslProcessGroupTermination } from '../wsl-process-group-termination'
import { createAbortError } from './abort-error'
import { killSpawnedCommandTree } from './spawned-command-tree-kill'
@@ -30,7 +31,10 @@ export async function execFileCaptureToTermination(
// Spawn cost is reported by spawnProcess's observer, which runProcess goes
// through; recording it again here would double-count every capture.
const pending = runProcess({
program: command,
program: resolveSelectedLocalCommand(command, {
env: options.env,
cwd: typeof options.cwd === 'string' ? options.cwd : undefined
}),
args,
cwd: typeof options.cwd === 'string' ? options.cwd : undefined,
env: options.env,