Skip to content
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

doc: add some info on tty#setRawMode() #10147

Merged
merged 1 commit into from
Dec 8, 2016

Conversation

Fishrock123
Copy link
Contributor

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, tty

Description of change

Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})

Related to #10037
Refs(?): http://docs.libuv.org/en/v1.x/tty.html#c.uv_tty_mode_t

@Fishrock123 Fishrock123 added doc Issues and PRs related to the documentations. tty Issues and PRs related to the tty subsystem. labels Dec 6, 2016
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tty Issues and PRs related to the tty subsystem. labels Dec 6, 2016
@@ -50,6 +50,10 @@ raw device. Defaults to `false`.
added: v0.7.7
-->

Allows configuration of `tty.ReadStream` so that it operates as a raw device.

For `stdin`, this mean that input is always available character-by-character (not including modifier characters such as `CTRL` or `ALT`). Additionally, all special processing of characters by the terminal is disabled, including echoing. (Such as when arrow keys or `CTRL`+`C` are pressed when running in default mode.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap at 80 characters.

Allows configuration of `tty.ReadStream` so that it operates as a raw device.

For `stdin`, this mean that input is always available character-by-character
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I’d just call them “modifiers”, I don’t think they count as characters in any meaningful context

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably just use a comma instead of parentheses.

@@ -50,6 +50,14 @@ raw device. Defaults to `false`.
added: v0.7.7
-->

Allows configuration of `tty.ReadStream` so that it operates as a raw device.

For `stdin`, this mean that input is always available character-by-character
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why For `stdin` ? This applies to all tty.ReadStreams equally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mean -> means

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well stdout doesn't usually receive this kind of input? Honestly I'm not really sure what this does to stdout...


For `stdin`, this mean that input is always available character-by-character
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all
special processing of characters by the terminal is disabled, including echoing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe expand “echoing” to “echoing input characters” for clarity

For `stdin`, this mean that input is always available character-by-character
(not including modifier characters such as `CTRL` or `ALT`). Additionally, all
special processing of characters by the terminal is disabled, including echoing.
(Such as when arrow keys or `CTRL`+`C` are pressed when running in default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the best way to improve it, but this sentence in parens looks off.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still wonder why stdin is being explicitly mentioned in the added text but other than that LGTM

@Fishrock123
Copy link
Contributor Author

@addaleax LGTY?

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, LGTM!

Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

```
if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})
```

Refs: nodejs#10037
PR-URL: nodejs#10147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@Fishrock123 Fishrock123 merged commit a0a6ff2 into nodejs:master Dec 8, 2016
Fishrock123 added a commit that referenced this pull request Dec 13, 2016
Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

```
if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})
```

Refs: #10037
PR-URL: #10147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Jan 16, 2017
Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

```
if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})
```

Refs: #10037
PR-URL: #10147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

```
if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})
```

Refs: #10037
PR-URL: #10147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
Partially taken from https://linux.die.net/man/3/cfmakeraw

A very simple test script:

```
if (process.argv[2] === 'raw')
  process.stdin.setRawMode(true)

process.stdin.on('data', (chunk) => {
  console.log(chunk)
  console.log(chunk.toString())
})
```

Refs: #10037
PR-URL: #10147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants