Skip to content

Commit d74decf

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 <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 32ee556 commit d74decf

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
@@ -1512,8 +1512,10 @@ Android)
15121512

15131513
* {Stream}
15141514

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

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

15231525
* {Stream}
15241526

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

15281532
For example:
15291533

@@ -1542,7 +1546,7 @@ process.stdin.on('end', () => {
15421546
});
15431547
```
15441548

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

@@ -1554,8 +1558,10 @@ must call `process.stdin.resume()` to read from it. Note also that calling
15541558

15551559
* {Stream}
15561560

1557-
The `process.stdout` property returns a [Writable][] stream connected to
1558-
`stdout` (fd `1`).
1561+
The `process.stdout` property returns a stream connected to
1562+
`stdout` (fd `1`). It is a [`net.Socket`][] (which is a [Duplex][]
1563+
stream) unless fd `1` refers to a file, in which case it is
1564+
a [Writable][] stream.
15591565

15601566
For example, to copy process.stdin to process.stdout:
15611567

@@ -1790,6 +1796,7 @@ cases:
17901796
[TTY]: tty.html#tty_tty
17911797
[Writable]: stream.html#stream_writable_streams
17921798
[Readable]: stream.html#stream_readable_streams
1799+
[Duplex]: stream.html#stream_duplex_and_transform_streams
17931800
[Child Process]: child_process.html
17941801
[Cluster]: cluster.html
17951802
[`process.exitCode`]: #process_process_exitcode

0 commit comments

Comments
 (0)