Render run output with xterm.js instead of plain text
Replaces the plain-text output <div> with a real xterm.js terminal (@xterm/xterm + @xterm/addon-fit), so ANSI color/control codes from scripts render as actual colors instead of raw escape characters. stderr chunks are wrapped in ANSI red so failures stand out even from tools that don't colorize their own output. Also sets FORCE_COLOR=1/ CLICOLOR_FORCE=1 as env defaults (real/script env still wins) since scripts run without a real TTY and most tools auto-disable color without one of these overrides. Fixed a React Strict Mode bug found while testing: the initial log was written to the terminal via a "write once" ref flag in the parent, but Strict Mode's dev-only mount->cleanup->remount cycle creates a fresh Terminal on the real mount, so that flag silently skipped writing to the surviving instance - the terminal looked completely blank until live output arrived. Fixed by writing initialData inside the same effect that creates the Terminal, so it's correct by construction regardless of how many times the effect runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -107,7 +107,16 @@ async function executeRun(
|
||||
try {
|
||||
const subprocess = execa(script.command, invocation.argv, {
|
||||
cwd,
|
||||
env: { ...process.env, ...invocation.env },
|
||||
// Scripts run without a real TTY, so most CLI tools auto-disable color; these are the two
|
||||
// most widely honored override conventions (not universal - true TTY-detecting tools like
|
||||
// GNU coreutils' `--color=auto` still won't colorize without a pty). Real env/script-set
|
||||
// env still win, so this is only a default.
|
||||
env: {
|
||||
FORCE_COLOR: "1",
|
||||
CLICOLOR_FORCE: "1",
|
||||
...process.env,
|
||||
...invocation.env,
|
||||
},
|
||||
timeout: script.timeoutSeconds * 1000,
|
||||
cancelSignal: controller.signal,
|
||||
reject: false,
|
||||
|
||||
Reference in New Issue
Block a user