blob: 490e8b143fe6ef4222c3fd7279b718e8b60128e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
---
name: Read stdout from a child process
---
When using [`Bun.spawn()`](/docs/api/spawn), the `stdout` of the child process can be consumed as a `ReadableStream` via `proc.stdout`.
```ts
const proc = Bun.spawn(["echo", "hello"]);
const output = await new Response(proc.stdout).text();
output; // => "hello"
```
---
To instead pipe the `stdout` of the child process to `stdout` of the parent process, set "inherit".
```ts
const proc = Bun.spawn(["echo", "hello"], {
stdout: "inherit",
});
```
---
See [Docs > API > Child processes](/docs/api/spawn) for complete documentation..
|