Skip to main content
When you spawn a child process with Bun.spawn(), proc.stdout is a ReadableStream of the child’s stdout.
const proc = Bun.spawn(["echo", "hello"]);

const output = await proc.stdout.text();
output; // => "hello"

To pipe the child process’s stdout to the parent’s stdout instead, set the stdout option to "inherit".
const proc = Bun.spawn(["echo", "hello"], {
  stdout: "inherit",
});

See Child processes.