Skip to content

Commit c683efb

Browse files
Fishrock123MylesBorins
authored andcommitted
doc: adjust TTY wording & add inter-doc links
PR-URL: #17702 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
1 parent 14ffddd commit c683efb

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

doc/api/tty.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ However, it can be accessed using:
1212
const tty = require('tty');
1313
```
1414

15-
When Node.js detects that it is being run inside a text terminal ("TTY")
16-
context, the `process.stdin` will, by default, be initialized as an instance of
17-
`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
15+
When Node.js detects that it is being run with a text terminal ("TTY")
16+
attached, [`process.stdin`][] will, by default, be initialized as an instance of
17+
`tty.ReadStream` and both [`process.stdout`][] and [`process.stderr`][] will, by
1818
default be instances of `tty.WriteStream`. The preferred method of determining
1919
whether Node.js is being run within a TTY context is to check that the value of
2020
the `process.stdout.isTTY` property is `true`:
@@ -27,15 +27,16 @@ false
2727
```
2828

2929
In most cases, there should be little to no reason for an application to
30-
create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
30+
manually create instances of the `tty.ReadStream` and `tty.WriteStream`
31+
classes.
3132

3233
## Class: tty.ReadStream
3334
<!-- YAML
3435
added: v0.5.8
3536
-->
3637

37-
The `tty.ReadStream` class is a subclass of `net.Socket` that represents the
38-
readable side of a TTY. In normal circumstances `process.stdin` will be the
38+
The `tty.ReadStream` class is a subclass of [`net.Socket`][] that represents the
39+
readable side of a TTY. In normal circumstances [`process.stdin`][] will be the
3940
only `tty.ReadStream` instance in a Node.js process and there should be no
4041
reason to create additional instances.
4142

@@ -52,7 +53,7 @@ raw device. Defaults to `false`.
5253
added: v0.5.8
5354
-->
5455

55-
A `boolean` that is always `true`.
56+
A `boolean` that is always `true` for `tty.ReadStream` instances.
5657

5758
### readStream.setRawMode(mode)
5859
<!-- YAML
@@ -77,8 +78,8 @@ added: v0.5.8
7778
-->
7879

7980
The `tty.WriteStream` class is a subclass of `net.Socket` that represents the
80-
writable side of a TTY. In normal circumstances, `process.stdout` and
81-
`process.stderr` will be the only `tty.WriteStream` instances created for a
81+
writable side of a TTY. In normal circumstances, [`process.stdout`][] and
82+
[`process.stderr`][] will be the only `tty.WriteStream` instances created for a
8283
Node.js process and there should be no reason to create additional instances.
8384

8485
### Event: 'resize'
@@ -130,3 +131,8 @@ added: v0.5.8
130131
The `tty.isatty()` method returns `true` if the given `fd` is associated with
131132
a TTY and `false` if it is not, including whenever `fd` is not a non-negative
132133
integer.
134+
135+
[`net.Socket`]: net.html#net_class_net_socket
136+
[`process.stdin`]: process.html#process_process_stdin
137+
[`process.stdout`]: process.html#process_process_stdout
138+
[`process.stderr`]: process.html#process_process_stderr

0 commit comments

Comments
 (0)