mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 00:02:48 +00:00
* fix(claude-accounts): quote resolved claude path for Windows shell spawn runClaudeCommand spawns the resolved claude command with shell:true on Windows, but spawn concatenates the command into the cmd.exe line without quoting. When the CLI resolves to a path containing spaces (e.g. C:\Users\First Last\AppData\Roaming\npm\claude.cmd), cmd.exe splits at the first space and account add fails with: 'C:\Users\First' is not recognized as an internal or external command Quote the command the same way claude-pty.ts and quoteWindowsCmdArg already do for other Windows spawns. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(claude-accounts): own Windows cmd invocation --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { buildWindowsCommandInvocation } from './windows-command-invocation'
|
|
|
|
describe('buildWindowsCommandInvocation', () => {
|
|
it('preserves hostile-but-valid cmd path and argument characters', () => {
|
|
const invocation = buildWindowsCommandInvocation(
|
|
'C:\\Users\\space & ^ (paren) %PATH_TRAP% !bang! 한글\\claude.cmd',
|
|
['', 'two words', 'amp&ersand', 'caret^value', '(parentheses)', '%ARG_TRAP%', '한글-λ'],
|
|
'C:\\Windows\\System32\\cmd.exe'
|
|
)
|
|
|
|
expect(invocation).toEqual({
|
|
command: 'C:\\Windows\\System32\\cmd.exe',
|
|
args: [
|
|
'/d',
|
|
'/v:off',
|
|
'/s',
|
|
'/c',
|
|
'""C:\\Users\\space & ^ (paren) "^%"PATH_TRAP"^%" !bang! 한글\\claude.cmd" "" "two words" "amp&ersand" "caret^value" "(parentheses)" ""^%"ARG_TRAP"^%"" "한글-λ""'
|
|
],
|
|
windowsVerbatimArguments: true
|
|
})
|
|
})
|
|
|
|
it('rejects tokens that cmd.exe cannot preserve safely', () => {
|
|
expect(() => buildWindowsCommandInvocation('claude.cmd', ['line\nbreak'])).toThrow(
|
|
'cannot contain quotes or line breaks'
|
|
)
|
|
expect(() => buildWindowsCommandInvocation('claude.cmd', ['quoted"value'])).toThrow(
|
|
'cannot contain quotes or line breaks'
|
|
)
|
|
})
|
|
})
|