Explorar el Código

fix(tui): disable all color output on Terminal.app

Terminal.app's CoreGraphics/ColorSync pipeline has a memory corruption
bug where UTF-8 text bytes (CJK, em dash 0xe28094) end up in color
space pointers, causing SIGSEGV. Even basic 16-color ANSI codes
trigger it. Set FORCE_COLOR=0 to make chalk emit zero escape codes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fanghanjun hace 7 meses
padre
commit
43a6523381
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      packages/cli/src/tui/app.ts

+ 7 - 0
packages/cli/src/tui/app.ts

@@ -110,6 +110,13 @@ export async function launchTui(
   projectRoot: string,
   toolsOverride?: InteractionRuntimeTools,
 ): Promise<void> {
+  // Terminal.app has a CoreGraphics bug where UTF-8 bytes (e.g. CJK, em dash)
+  // end up in color space pointers during ANSI color rendering, causing SIGSEGV.
+  // Disable all color output to avoid triggering the crash.
+  if (isAppleTerminal) {
+    process.env.FORCE_COLOR = "0";
+  }
+
   projectRoot = await resolveProjectRoot(projectRoot);
   const { hasLlmConfig } = await ensureProject(projectRoot);
   const projectLanguage = await detectProjectLanguage(projectRoot);