From e6fc02190356448080cbc489a5d0f96fbfbec8b8 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 14 Sep 2026 01:39:11 +0800 Subject: [PATCH] fix: drop leaked NO_COLOR/FORCE_COLOR from the pty environment (Claude Code rendered uncolored) --- src/main/pty.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/pty.ts b/src/main/pty.ts index 0997a11..4f79c07 100644 --- a/src/main/pty.ts +++ b/src/main/pty.ts @@ -148,6 +148,13 @@ export function createPty(opts: PtyCreateOptions = {}): PtyCreateResult { TERM_PROGRAM: 'OpenTerminal', ...opts.env } as Record + // NO_COLOR (no-color.org) leaks in from whatever launched the app — an agent + // CLI, an IDE, a CI shell. Every library that honors it (chalk and friends) + // then prints uncolored output, which reads as "this terminal is broken". + // The pty we hand out does truecolor, so the opt-out is dropped. Same for the + // explicit FORCE_COLOR=0 form of the same request. + delete env.NO_COLOR + if (env.FORCE_COLOR === '0') delete env.FORCE_COLOR const pty = spawn(shell, [], { name: 'xterm-256color', cols: 80, rows: 24, cwd, env }) sessions.set(id, { kind: 'local', pty })