mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 00:02:29 +00:00
Fix Windows setup sequencing wrapper quoting (#8806)
* fix(setup): correct Windows sequencing wrapper quoting * test(setup): preserve spaced Windows batch paths * refactor(setup): dedupe PowerShell encoder, clarify wrapCmd comment Route the Windows setup-sequencing and Hermes startup planners through the shared renderer-safe encodePowerShellCommand instead of two verbatim btoa copies, and make that shared encoder renderer-safe (Buffer is unavailable in the sandboxed renderer where both planners also run). Reword the wrapCmd comment so it describes the current single-outer-quote behavior instead of the old quote-doubling bug. * test(setup): cover Windows metacharacter paths * fix(setup): keep Windows runner paths out of cmd source * test(setup): preserve Windows setup failures * docs(setup): explain safe cmd path handoff --------- Co-authored-by: OrcaWin <alpha-eng@stably.ai> Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
export function encodePowerShellCommand(command: string): string {
|
||||
return Buffer.from(command, 'utf16le').toString('base64')
|
||||
// Why: some callers (setup sequencing, Hermes startup) run in the sandboxed
|
||||
// renderer where Node's Buffer is unavailable, so encode the UTF-16LE bytes
|
||||
// PowerShell's -EncodedCommand expects using only renderer-safe globals.
|
||||
let bytes = ''
|
||||
for (let index = 0; index < command.length; index += 1) {
|
||||
const code = command.charCodeAt(index)
|
||||
bytes += String.fromCharCode(code & 0xff, code >>> 8)
|
||||
}
|
||||
return btoa(bytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user