Skip to content

CliIo

The output seam every CLI writes through, instead of naming process.stdout / process.stderr itself.

A handler that writes to a process stream directly cannot be tested without monkeypatching a global, and a patch that leaks on a missed finally corrupts every other test in the process. An injected sink is captured instead.

Exit codes are NOT part of this seam. They stay ordinary return values — CliIo covers what gets printed, not whether the run succeeded.

There is no stdin member, and ambient values a command needs beyond output live in CliContext rather than widening this. An interactive surface owning the terminal — raw mode, keystrokes, handing the terminal to a spawned task — is a different thing, and folding it into a seam meant for one-shot output would blur both.

stderr(text): void

ParameterType
textstring

void


stdout(text): void

ParameterType
textstring

void