rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

When using Bun.spawn(), the stdout of the child process can be consumed as a ReadableStream via proc.stdout.

const proc = Bun.spawn(["echo", "hello"]);

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

To instead pipe the stdout of the child process to stdout of the parent process, set “inherit”.

const proc = Bun.spawn(["echo", "hello"], {
  stdout: "inherit",
});

See Docs > API > Child processes for complete documentation.

Was this page helpful?

Suggest editsRaise issue

[

Spawn a child process

Previous

](../spawn/index.md)[

Read stderr from a child process

Next

](../spawn-stderr/index.md)