source dump of claude code
at main 17 lines 553 B view raw
1import { whichSync } from './which.js' 2 3/** 4 * Find an executable by searching PATH, similar to `which`. 5 * Replaces spawn-rx's findActualExecutable to avoid pulling in rxjs (~313 KB). 6 * 7 * Returns { cmd, args } to match the spawn-rx API shape. 8 * `cmd` is the resolved path if found, or the original name if not. 9 * `args` is always the pass-through of the input args. 10 */ 11export function findExecutable( 12 exe: string, 13 args: string[], 14): { cmd: string; args: string[] } { 15 const resolved = whichSync(exe) 16 return { cmd: resolved ?? exe, args } 17}