mirror of
https://github.com/stablyai/orca.git
synced 2026-10-08 08:02:32 +00:00
Resume-in-tab/drag-resume queued a cmd.exe-syntax command into a freshly spawned tab whose live shell is the configured Windows shell (default PowerShell). PowerShell mis-parsed the cmd ""-doubled wrapper and reported "is not recognized as an internal or external command, operable program or batch file", so the session never resumed. Resolve terminalWindowsShell to a startup-shell family and quote the queued command per shell (PowerShell Set-Location/$env, POSIX cd for git-bash), only emitting the cmd /d /s /c wrapper when the live shell is cmd. The copy-to-clipboard command is unchanged and stays cmd-wrapped. Fixes #6152 Co-authored-by: Orca <help@stably.ai>
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { resolveWindowsShellStartupFamily } from './windows-terminal-shell'
|
|
|
|
describe('resolveWindowsShellStartupFamily', () => {
|
|
it('defaults to PowerShell when unset', () => {
|
|
expect(resolveWindowsShellStartupFamily(undefined)).toBe('powershell')
|
|
expect(resolveWindowsShellStartupFamily(null)).toBe('powershell')
|
|
expect(resolveWindowsShellStartupFamily(' ')).toBe('powershell')
|
|
})
|
|
|
|
it('treats PowerShell and pwsh as PowerShell', () => {
|
|
expect(resolveWindowsShellStartupFamily('powershell.exe')).toBe('powershell')
|
|
expect(resolveWindowsShellStartupFamily('pwsh.exe')).toBe('powershell')
|
|
expect(resolveWindowsShellStartupFamily('C:\\Program Files\\PowerShell\\7\\pwsh.exe')).toBe(
|
|
'powershell'
|
|
)
|
|
})
|
|
|
|
it('maps cmd.exe to cmd quoting', () => {
|
|
expect(resolveWindowsShellStartupFamily('cmd.exe')).toBe('cmd')
|
|
expect(resolveWindowsShellStartupFamily('C:\\Windows\\System32\\cmd.exe')).toBe('cmd')
|
|
})
|
|
|
|
it('maps Git Bash and WSL shells to POSIX quoting', () => {
|
|
expect(resolveWindowsShellStartupFamily('git-bash')).toBe('posix')
|
|
expect(resolveWindowsShellStartupFamily('wsl.exe')).toBe('posix')
|
|
expect(resolveWindowsShellStartupFamily('C:\\Program Files\\Git\\bin\\bash.exe')).toBe('posix')
|
|
})
|
|
})
|