mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-07-20 14:34:50 +00:00
Strip Ink v7 DEC mode 2026 synchronized output markers (BSU/ESU) on Windows. ConPTY does not implement this protocol and buffers indefinitely, causing the dashboard to hang with no output. The patch intercepts standalone BSU/ESU writes on stdout while preserving full interactivity (keyboard, live refresh, cursor management). Fix ExperimentalWarning timing: the process.emit patch was restored synchronously in the finally block, but Node defers the warning via process.nextTick. Delay restore by one tick so the patch is still active when the warning fires. Closes #195
14 lines
477 B
TypeScript
14 lines
477 B
TypeScript
const BSU = '\x1b[?2026h'
|
|
const ESU = '\x1b[?2026l'
|
|
let patched = false
|
|
|
|
export function patchStdoutForWindows(): void {
|
|
if (process.platform !== 'win32' || patched) return
|
|
patched = true
|
|
|
|
const origWrite = process.stdout.write.bind(process.stdout)
|
|
process.stdout.write = function (chunk: unknown, ...args: unknown[]): boolean {
|
|
if (chunk === BSU || chunk === ESU) return true
|
|
return (origWrite as Function)(chunk, ...args)
|
|
} as typeof process.stdout.write
|
|
}
|