mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
Ensure terminal E2E probes run reliably on Windows CI, where the shell does not always inherit setup-node's PATH. - Add `nodeTerminalCommand` helper to resolve and quote `process.execPath` for either POSIX shells or PowerShell depending on the platform. - Update terminal tests and probes to use the new helper instead of hardcoded `node` invocations.
21 lines
787 B
TypeScript
21 lines
787 B
TypeScript
function quotePosixShellArg(value: string): string {
|
|
return `'${value.replaceAll("'", "'\\''")}'`
|
|
}
|
|
|
|
function quotePowerShellArg(value: string): string {
|
|
return `'${value.replaceAll("'", "''")}'`
|
|
}
|
|
|
|
function quoteTerminalArg(value: string): string {
|
|
return process.platform === 'win32' ? quotePowerShellArg(value) : quotePosixShellArg(value)
|
|
}
|
|
|
|
export function nodeTerminalCommand(args: readonly string[]): string {
|
|
const nodeExecutable = quoteTerminalArg(process.execPath)
|
|
const executable = process.platform === 'win32' ? `& ${nodeExecutable}` : nodeExecutable
|
|
|
|
// Why: Windows CI shells do not always inherit setup-node's PATH, so E2E
|
|
// terminal probes must invoke the runner's Node executable directly.
|
|
return [executable, ...args.map(quoteTerminalArg)].join(' ')
|
|
}
|