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

process.stdin.setRawMode(true) does not return process.stdin? #22916

Closed
ORESoftware opened this issue Sep 17, 2018 · 5 comments
Closed

process.stdin.setRawMode(true) does not return process.stdin? #22916

ORESoftware opened this issue Sep 17, 2018 · 5 comments
Labels
tty Issues and PRs related to the tty subsystem.

Comments

@ORESoftware
Copy link
Contributor

ORESoftware commented Sep 17, 2018

I have this:

process.stdin.setRawMode(true);

but I cannot use it like so:

process.stdin.setRawMode(true).on('data' fn);

just curious if that is true and why that is. It could just be that the TypeScript typings are wrong.
Anyway, I would expect that process.stdin.setRawMode() would return the same thing as process.stdin.setEncoding().

@vsemozhetbyt
Copy link
Contributor

FWIW, these signatures are documented differently:

https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode
https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding

And .setRawMode() does not return this:

node/lib/tty.js

Lines 69 to 73 in bb9d788

ReadStream.prototype.setRawMode = function(flag) {
flag = !!flag;
this._handle.setRawMode(flag);
this.isRaw = flag;
};

@ORESoftware
Copy link
Contributor Author

yeah it should right, why not. Shouldn't break anybody to return this right?

@addaleax
Copy link
Member

@ORESoftware Yes, I think this would be okay to add – do you want to open a PR maybe?

@ORESoftware
Copy link
Contributor Author

sure I can do that, I would also want to update the TypeScript typings for this

@Fishrock123
Copy link
Contributor

I would also want to update the TypeScript typings for this

I don't think we maintain those but the actual change seems fine to me.

@addaleax addaleax added the tty Issues and PRs related to the tty subsystem. label Sep 21, 2018
targos pushed a commit that referenced this issue Sep 23, 2018
PR-URL: #22950
Fixes: #22916
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Denys Otrishko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants