MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / makeFileOutput

Function makeFileOutput

src/commands/test.ts:7808–7821  ·  view source on GitHub ↗

* Adapter that turns a `FileSink` into the `Output` writer set. Both * `print` (line-oriented JSON) and `writeChunk` (raw bytes) flow into * the same stream; backpressure is preserved on the chunk path by * resolving the returned promise on `'drain'` when the kernel buffer * is full, mirroring t

(mode: OutputMode, sink: FileSink)

Source from the content-addressed store, hash-verified

7806 * is full, mirroring the stdout writer in `output.ts`.
7807 */
7808function makeFileOutput(mode: OutputMode, sink: FileSink): Output {
7809 return new Output(mode, {
7810 stdout: line => {
7811 sink.stream.write(`${line}\n`);
7812 },
7813 rawStdout: text => {
7814 if (sink.error) throw sink.error;
7815 if (sink.stream.write(text)) return;
7816 return new Promise<void>(resolve => {
7817 sink.stream.once('drain', () => resolve());
7818 });
7819 },
7820 });
7821}
7822
7823/**
7824 * Flush + close the file sink. Called on the success path after the

Callers 1

runCodeGetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected