> ## Documentation Index
> Fetch the complete documentation index at: https://bun.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://bun.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://bun.manicule.dev/api/mcp.
> Every agent surface: https://bun.manicule.dev/.well-known/llms-manifest.json

# Read stderr from a child process (/guides/process/spawn-stderr)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 150 · updated: 2026-08-02 -->
Related: [Parse command-line arguments](/guides/process/argv.md), [Listen for CTRL+C](/guides/process/ctrl-c.md), [Spawn a child process and communicate using IPC](/guides/process/ipc.md), [Get the process uptime in nanoseconds](/guides/process/nanoseconds.md), [Listen to OS signals](/guides/process/os-signals.md), [Read stdout from a child process](/guides/process/spawn-stdout.md)

When you spawn a child process with [`Bun.spawn()`](/runtime/child-process), it inherits the `stderr` of the spawning process. To read and handle `stderr` instead, set the `stderr` option to `"pipe"`.

```ts
const proc = Bun.spawn(["echo", "hello"], {
  stderr: "pipe",
});

proc.stderr; // => ReadableStream
```

***

To read `stderr` until the child process exits, use `.text()`.

```ts
const proc = Bun.spawn(["echo", "hello"], {
  stderr: "pipe",
});

const errors: string = await proc.stderr.text();
if (errors) {
  // handle errors
}
```

***

See [Child processes](/runtime/child-process).
