MCPcopy
hub / github.com/claude-code-best/claude-code / exitWithMessage

Function exitWithMessage

src/interactiveHelpers.tsx:80–97  ·  view source on GitHub ↗
(
  root: Root,
  message: string,
  options?: {
    color?: TextProps['color'];
    exitCode?: number;
    beforeExit?: () => Promise<void>;
  },
)

Source from the content-addressed store, hash-verified

78 * through the React tree instead.
79 */
80export async function exitWithMessage(
81 root: Root,
82 message: string,
83 options?: {
84 color?: TextProps['color'];
85 exitCode?: number;
86 beforeExit?: () => Promise<void>;
87 },
88): Promise<never> {
89 const { Text } = await import('@anthropic/ink');
90 const color = options?.color;
91 const exitCode = options?.exitCode ?? 1;
92 root.render(color ? <Text color={color}>{message}</Text> : <Text>{message}</Text>);
93 root.unmount();
94 await options?.beforeExit?.();
95 // eslint-disable-next-line custom-rules/no-process-exit -- exit after Ink unmount
96 process.exit(exitCode);
97}
98
99/**
100 * Show a setup dialog wrapped in AppStateProvider + KeybindingSetup.

Callers 1

exitWithErrorFunction · 0.70

Calls 2

unmountMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected