mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 08:02:35 +00:00
19 lines
777 B
TypeScript
19 lines
777 B
TypeScript
import { quotePowerShellLiteral } from '../../src/shared/powershell-native-argument'
|
|
|
|
function quotePosixShellArg(value: string): string {
|
|
return `'${value.replaceAll("'", "'\\''")}'`
|
|
}
|
|
|
|
function quoteTerminalArg(value: string): string {
|
|
return process.platform === 'win32' ? quotePowerShellLiteral(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(' ')
|
|
}
|