mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
24 lines
506 B
TypeScript
24 lines
506 B
TypeScript
// In-memory stdout/stderr capture helper for command tests.
|
|
|
|
/** Create a minimal IO object plus readers for captured output. */
|
|
export function createCapturedIo() {
|
|
let stdout = "";
|
|
let stderr = "";
|
|
return {
|
|
io: {
|
|
stdout: {
|
|
write(chunk: unknown) {
|
|
stdout += String(chunk);
|
|
},
|
|
},
|
|
stderr: {
|
|
write(chunk: unknown) {
|
|
stderr += String(chunk);
|
|
},
|
|
},
|
|
},
|
|
readStdout: () => stdout,
|
|
readStderr: () => stderr,
|
|
};
|
|
}
|