export interface ExecShellPlanOptions { /** * Injected in tests; defaults to the real filesystem. This is the only * injection point on the Windows path — the interpreter PATH itself is a * constant (WINDOWS_POWERSHELL_PATH) and deliberately cannot be overridden, * by a test or by anything else. */ exists?: (candidate: string) => boolean; } /** * The result of planning. * * `posixShell` is what to hand Node's spawn `shell` option on POSIX (`true` = * /bin/sh, a path = that interpreter). It is always `true` and always IGNORED on * Windows, where nothing is spawned through a shell at all: the command goes to * the signed launcher, which runs cmd.exe itself. * * `command` is the text to run. Only the Windows PowerShell path rewrites it; * every other path hands back exactly what it was given. * * `clixmlStderr` says the stderr of the resulting process needs the PowerShell * CLIXML decoder (powershell-clixml.ts) in front of it. It is set on exactly ONE * path — the -EncodedCommand wrapping below — because the CLIXML is a side effect * of that wrapping and of nothing else. It travels on the plan rather than being * re-derived from `shell` in executor.ts so that the decision stays where the * wrapping decision is: change the wrapping here and the flag changes with it, * instead of a second file quietly disagreeing about which commands were * wrapped. cmd, sh and bash never carry it and their stderr is byte-identical to * what it was before this existed. */ export type ExecShellPlan = { ok: true; command: string; posixShell: true | string; clixmlStderr?: true; } | { ok: false; message: string; }; /** * Resolve a requested shell for THIS machine. * * `shell` arrives off a relay frame, so it is treated as untrusted input: an * unknown string, or one belonging to the other platform family, is refused * with the same message the relay would have produced. `undefined` is the * documented "machine default" and is the only value that changes nothing. */ export declare function planExecShell(platform: NodeJS.Platform | string, shell: string | undefined, command: string, options?: ExecShellPlanOptions): ExecShellPlan;