Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

839 B
Raw Blame
import { decodePosixWaitStatus, describePosixWaitStatus } from './posix-wait-status'

/** Show raw POSIX wait status before decoded exit/signal meaning; preserve Windows and launch-failed codes unchanged. */
export function formatCrashReportExitCode(report: {
  exitCode: number | null
  platform: NodeJS.Platform
  reason: string
}): string {
  if (report.exitCode === null || report.exitCode === undefined) {
    return 'unknown'
  }
  const decoded =
    report.platform === 'win32' || report.reason === 'launch-failed'
      ? null
      : decodePosixWaitStatus(report.exitCode)
  // A clean exit(0) decodes to itself; the suffix would only add noise.
  if (!decoded || (decoded.kind === 'exited' && report.exitCode === 0)) {
    return String(report.exitCode)
  }
  return `${report.exitCode} (${describePosixWaitStatus(decoded)})`
}