Files
orca/src/cli/wsl-distro-cli-refusal.ts
T
Neil d8a66e41c9 fix(wsl): name the stopped distro, not its raw hold code, wherever a held terminal is shown (#37380)
The terminal error banner and a paired host's held pane showed
terminal_held_wsl_distro_*:<distro> as is; the banner now swaps either
the code (older hosts) or the English sentence (newer hosts) for the
localized copy, and drops the issue link for it. A held start that
arrives as the sentence now gets the Start card too. The CLI names the
distro for an older server's raw hold code and for an unavailable WSL
folder. The banner's footer reports the shell whose spawn failed
(wsl.exe, say) instead of the client's default shell.
2026-11-01 23:17:46 -08:00

23 lines
1.0 KiB
TypeScript

import { readableWslDistroHoldText } from '../shared/wsl-distro-stopped-hold'
import { parseWslUncPath } from '../shared/wsl-paths'
const FOLDER_UNAVAILABLE_PREFIX = 'folder_workspace_path_unavailable:'
/**
* A refusal over a WSL distro, named: older servers send the raw hold code, and a folder on a
* distro Orca won't start in the background reads only as "path unavailable".
*/
export function readableWslDistroCliRefusal(message: string): string {
const held = readableWslDistroHoldText(message)
if (held !== message) {
return held
}
const start = message.indexOf(FOLDER_UNAVAILABLE_PREFIX)
const path = start === -1 ? '' : message.slice(start + FOLDER_UNAVAILABLE_PREFIX.length).trim()
const distro = parseWslUncPath(path)?.distro
if (!distro) {
return message
}
return `${message.slice(0, start)}Orca couldn't reach ${path}. The WSL distro ${distro} may be stopped, and Orca doesn't start a stopped distro for this. Start ${distro} (for example, open a terminal in it), then try again.`
}