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

Fixed constant "fd" value to start from 0x7fffffff instead of 0xffffffff #277

Merged
merged 1 commit into from Dec 11, 2018

Conversation

reinaldoarrosi
Copy link
Contributor

Fixes #274

It's worth to mention that, even though this change does fix the error described in #274, the code in that issue will throw a different error because of the way that tty.WriteStream works internally.

Anyway, it's good to make sure that the file descriptors follow the unix guidelines.

@streamich streamich merged commit 31e44ba into streamich:master Dec 11, 2018
@streamich
Copy link
Owner

Thanks!

@streamich
Copy link
Owner

... will throw a different error because of the way that tty.WriteStream works internally.

What do you exactly mean? Why tty.WriteStream throws?

streamich pushed a commit that referenced this pull request Dec 11, 2018
## [2.14.2](v2.14.1...v2.14.2) (2018-12-11)

### Bug Fixes

* fds to start from 0x7fffffff instead of 0xffffffff ([#277](#277)) ([31e44ba](31e44ba))
@streamich
Copy link
Owner

🎉 This PR is included in version 2.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@reinaldoarrosi
Copy link
Contributor Author

reinaldoarrosi commented Dec 12, 2018

tty.WriteStream does not work with arbitrary file descriptors, in fact even using fs.openSync(<path_to_a_file>) to get a fd that points to an actual file and then using this fd to instantiate tty.WriteStream will fail with EBADF: bad file descriptor, uv_tty_init

I believe this happens because tty.WriteStream checks to see if the fd is one of the stdio file descriptors (0 - stdin, 1 - stdout, 2 - stderr).

@streamich
Copy link
Owner

Ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File descriptor number is out of range
2 participants