Skip to content

Commit b3a6a25

Browse files
committed
doc: stdout, stderr and stdin are all Duplex streams but documentation states otherwise
This is a fix for #9201
1 parent 88daf88 commit b3a6a25

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

doc/api/process.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,8 +1509,10 @@ Android)
15091509

15101510
* {Stream}
15111511

1512-
The `process.stderr` property returns a [Writable][] stream connected to
1513-
`stderr` (fd `2`).
1512+
The `process.stderr` property returns a stream connected to
1513+
`stderr` (fd `2`). It is a [`net.Socket`][] (which is a [Duplex][]
1514+
stream) unless fd `2` refers to a file, in which case it is
1515+
a [Writable][] stream.
15141516

15151517
Note: `process.stderr` differs from other Node.js streams in important ways,
15161518
see [note on process I/O][] for more information.
@@ -1519,8 +1521,10 @@ see [note on process I/O][] for more information.
15191521

15201522
* {Stream}
15211523

1522-
The `process.stdin` property returns a [Readable][] stream equivalent to or
1523-
associated with `stdin` (fd `0`).
1524+
The `process.stdin` property returns a stream connected to
1525+
`stdin` (fd `0`). It is a [`net.Socket`][] (which is a [Duplex][]
1526+
stream) unless fd `0` refers to a file, in which case it is
1527+
a [Readable][] stream.
15241528

15251529
For example:
15261530

@@ -1539,7 +1543,7 @@ process.stdin.on('end', () => {
15391543
});
15401544
```
15411545

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

@@ -1551,8 +1555,10 @@ must call `process.stdin.resume()` to read from it. Note also that calling
15511555

15521556
* {Stream}
15531557

1554-
The `process.stdout` property returns a [Writable][] stream connected to
1555-
`stdout` (fd `1`).
1558+
The `process.stdout` property returns a stream connected to
1559+
`stdout` (fd `1`). It is a [`net.Socket`][] (which is a [Duplex][]
1560+
stream) unless fd `1` refers to a file, in which case it is
1561+
a [Writable][] stream.
15561562

15571563
For example, to copy process.stdin to process.stdout:
15581564

@@ -1793,6 +1799,7 @@ cases:
17931799
[TTY]: tty.html#tty_tty
17941800
[Writable]: stream.html#stream_writable_streams
17951801
[Readable]: stream.html#stream_readable_streams
1802+
[Duplex]: stream.html#stream_duplex_and_transform_streams
17961803
[Child Process]: child_process.html
17971804
[Cluster]: cluster.html
17981805
[`process.exitCode`]: #process_process_exitcode

0 commit comments

Comments
 (0)