Files
orca/src/main/cli/cli-install-errors.ts
T
Neil 83ffc0df24 refactor Electron facilities modules (#16333)
* refactor oversized Electron facilities

* fix interactive process timeout and shortcut repeat guard

* chore(child-process): drop stale cli-installer allowlist entry

cli-installer.ts now routes privileged spawns through runProcess via
cli-privileged-processes.ts, so the shrink-only ratchet flags it as stale.

* refactor(child-process): extract the bounded output sink

runProcess's timeoutMs opt-out (required to preserve the unbounded osascript
admin prompt) pushed run-process.ts past the 300-line cap. Move createOutputSink
to its own module rather than add a max-lines bypass, which AGENTS.md forbids.
Moved verbatim; no behavior change.
2026-08-25 00:31:31 -07:00

34 lines
1.1 KiB
TypeScript

export function isPermissionError(error: unknown): boolean {
return (
error instanceof Error &&
'code' in error &&
((error as NodeJS.ErrnoException).code === 'EACCES' ||
(error as NodeJS.ErrnoException).code === 'EPERM')
)
}
export function isMissingError(error: unknown): boolean {
return (
error instanceof Error && 'code' in error && (error as NodeJS.ErrnoException).code === 'ENOENT'
)
}
// Why: localized permission errors keep these .NET/ACL markers even when the PowerShell text is mojibake.
export function isWindowsUserPathPermissionError(error: unknown): boolean {
if (!(error instanceof Error)) {
return false
}
const stderr =
'stderr' in error && typeof (error as { stderr?: unknown }).stderr === 'string'
? (error as { stderr: string }).stderr
: ''
const haystack = `${error.message}\n${stderr}`
return (
haystack.includes('UnauthorizedAccessException') ||
haystack.includes('SecurityException') ||
haystack.includes('Requested registry access is not allowed') ||
haystack.includes('Access is denied') ||
haystack.includes('Access to the registry key')
)
}