Commit Graph
1 Commits
Author SHA1 Message Date
Malte UblandClaude Code 7dbcf07fe0 Pass console lines and byte chunks to a patched stdio write
Node's console writes each formatted line with stream.write(line,
errorHandler), so a replaced process.stdout.write sees a string and a
function; a Buffer write arrives as a Buffer. The stdio write hook carried
only a `wide` bit, so every intercepted chunk became a JavaScript string and
console lines carried a single argument.

Replace that bit with a `flags` int (SCR_STDIO_HOOK_WIDE, _CONSOLE, _BYTES)
and keep the hook signature at four parameters, so the console write path and
the byte paths differ only in what they pass. scr_stdio_intercept now builds a
chunk instead of a string, boxes SCR_STDIO_HOOK_BYTES as a Buffer, and appends
a console error handler for SCR_STDIO_HOOK_CONSOLE. Text callers of the old
string entry point move to a new scr_stdio_write_text.

Corpus: stdout-patch-console-arguments.js.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude 5.5 <noreply@anthropic.com>
2026-10-28 20:08:13 -07:00