-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a couple doc improvements / fixes #17702
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,9 @@ However, it can be accessed using: | |
const tty = require('tty'); | ||
``` | ||
|
||
When Node.js detects that it is being run inside a text terminal ("TTY") | ||
context, the `process.stdin` will, by default, be initialized as an instance of | ||
`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by | ||
When Node.js detects that it is being run with a text terminal ("TTY") | ||
attached, [`process.stdin`][] will, by default, be initialized as an instance of | ||
`tty.ReadStream` and both [`process.stdout`][] and [`process.stderr`][] will, by | ||
default be instances of `tty.WriteStream`. The preferred method of determining | ||
whether Node.js is being run within a TTY context is to check that the value of | ||
the `process.stdout.isTTY` property is `true`: | ||
|
@@ -27,15 +27,16 @@ false | |
``` | ||
|
||
In most cases, there should be little to no reason for an application to | ||
create instances of the `tty.ReadStream` and `tty.WriteStream` classes. | ||
manually create instances of the `tty.ReadStream` and `tty.WriteStream` | ||
classes. | ||
|
||
## Class: tty.ReadStream | ||
<!-- YAML | ||
added: v0.5.8 | ||
--> | ||
|
||
The `tty.ReadStream` class is a subclass of `net.Socket` that represents the | ||
readable side of a TTY. In normal circumstances `process.stdin` will be the | ||
The `tty.ReadStream` class is a subclass of [`net.Socket`][] that represents the | ||
readable side of a TTY. In normal circumstances [`process.stdin`][] will be the | ||
only `tty.ReadStream` instance in a Node.js process and there should be no | ||
reason to create additional instances. | ||
|
||
|
@@ -52,7 +53,7 @@ raw device. Defaults to `false`. | |
added: v0.5.8 | ||
--> | ||
|
||
A `boolean` that is always `true`. | ||
A `boolean` that is always `true` for `tty.ReadStream` instances. | ||
|
||
### readStream.setRawMode(mode) | ||
<!-- YAML | ||
|
@@ -77,8 +78,8 @@ added: v0.5.8 | |
--> | ||
|
||
The `tty.WriteStream` class is a subclass of `net.Socket` that represents the | ||
writable side of a TTY. In normal circumstances, `process.stdout` and | ||
`process.stderr` will be the only `tty.WriteStream` instances created for a | ||
writable side of a TTY. In normal circumstances, [`process.stdout`][] and | ||
[`process.stderr`][] will be the only `tty.WriteStream` instances created for a | ||
Node.js process and there should be no reason to create additional instances. | ||
|
||
### Event: 'resize' | ||
|
@@ -130,3 +131,8 @@ added: v0.5.8 | |
The `tty.isatty()` method returns `true` if the given `fd` is associated with | ||
a TTY and `false` if it is not, including whenever `fd` is not a non-negative | ||
integer. | ||
|
||
[`net.Socket`]: net.html#net_class_net_socket | ||
[`process.stdin`]: process.html#process_process_stdin | ||
[`process.stdout`]: process.html#process_process_stdout | ||
[`process.stderr`]: process.html#process_process_stderr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A nit: out of ABC order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we actually been enforcing this? I'm kinda clueless - if we have been generally I'll change it, if not... maybe we should do that separately with linting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I thought it was enforced in doc linting or style guide, but it seems I am wrong, I cannot even find PRs that sort references explicitly (I recall there were some). So maybe it is OK as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For posterity: these are ordered (pretty sure I got it right) in their order of references. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Non-blocking) I'd remove
*Note*:
here and save it for things that really truly need it. Also remove the**Note**:
(note different typography 🙄 ) later in this doc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it worth keeping on that one.