Skip to content

Commit 5e3d429

Browse files
seppevsMylesBorins
authored andcommitted
doc: stdout/err/in are all Duplex streams
stdout, stderr and stdin are all Duplex streams but documentation states otherwise Fixes #9201 PR-URL: #11194 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 7f6b03f commit 5e3d429

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

doc/api/process.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -1496,8 +1496,10 @@ Android)
14961496

14971497
* {Stream}
14981498

1499-
The `process.stderr` property returns a [Writable][] stream connected to
1500-
`stderr` (fd `2`).
1499+
The `process.stderr` property returns a stream connected to
1500+
`stderr` (fd `2`). It is a [`net.Socket`][] (which is a [Duplex][]
1501+
stream) unless fd `2` refers to a file, in which case it is
1502+
a [Writable][] stream.
15011503

15021504
Note: `process.stderr` differs from other Node.js streams in important ways,
15031505
see [note on process I/O][] for more information.
@@ -1506,8 +1508,10 @@ see [note on process I/O][] for more information.
15061508

15071509
* {Stream}
15081510

1509-
The `process.stdin` property returns a [Readable][] stream equivalent to or
1510-
associated with `stdin` (fd `0`).
1511+
The `process.stdin` property returns a stream connected to
1512+
`stdin` (fd `0`). It is a [`net.Socket`][] (which is a [Duplex][]
1513+
stream) unless fd `0` refers to a file, in which case it is
1514+
a [Readable][] stream.
15111515

15121516
For example:
15131517

@@ -1526,7 +1530,7 @@ process.stdin.on('end', () => {
15261530
});
15271531
```
15281532

1529-
As a [Readable][] stream, `process.stdin` can also be used in "old" mode that
1533+
As a [Duplex][] stream, `process.stdin` can also be used in "old" mode that
15301534
is compatible with scripts written for Node.js prior to v0.10.
15311535
For more information see [Stream compatibility][].
15321536

@@ -1538,8 +1542,10 @@ must call `process.stdin.resume()` to read from it. Note also that calling
15381542

15391543
* {Stream}
15401544

1541-
The `process.stdout` property returns a [Writable][] stream connected to
1542-
`stdout` (fd `1`).
1545+
The `process.stdout` property returns a stream connected to
1546+
`stdout` (fd `1`). It is a [`net.Socket`][] (which is a [Duplex][]
1547+
stream) unless fd `1` refers to a file, in which case it is
1548+
a [Writable][] stream.
15431549

15441550
For example, to copy process.stdin to process.stdout:
15451551

@@ -1780,6 +1786,7 @@ cases:
17801786
[TTY]: tty.html#tty_tty
17811787
[Writable]: stream.html#stream_writable_streams
17821788
[Readable]: stream.html#stream_readable_streams
1789+
[Duplex]: stream.html#stream_duplex_and_transform_streams
17831790
[Child Process]: child_process.html
17841791
[Cluster]: cluster.html
17851792
[`process.exitCode`]: #process_process_exitcode

0 commit comments

Comments
 (0)