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

util: add guessHandleType method #2797

Closed
wants to merge 1 commit into from

Conversation

evanlucas
Copy link
Contributor

With moving in the direction of deprecating process.binding,
it makes sense to expose the ability to guess the handle type
of an fd.

Does it make sense that this is exposed in tty?

An example of where this would be useful is debug which
is a quite popular package. (https://github.com/visionmedia/debug/blob/master/node.js#L144-L203)

Related: #2768

@evanlucas evanlucas added the semver-minor PRs that contain new features and should be released in the next minor version. label Sep 10, 2015
@evanlucas
Copy link
Contributor Author

@mscdex
Copy link
Contributor

mscdex commented Sep 10, 2015

+1 to making it public, but I don't think tty is the best place to put it. Perhaps util would be better?

@evanlucas
Copy link
Contributor Author

I don't want to bloat util, but I think it makes more sense.

With moving in the direction of deprecating process.binding,
it makes sense to expose the ability to guess the handle type
of an fd.
@evanlucas evanlucas changed the title tty: add guessHandleType method util: add guessHandleType method Sep 10, 2015
@evanlucas
Copy link
Contributor Author

Ok, changed to util

@bnoordhuis
Copy link
Member

Has anyone actually asked for this? I know the debug module uses tty_wrap.guessHandleType() but that's because it copied createWritableStdioStream() from src/node.js wholesale.

@evanlucas
Copy link
Contributor Author

Not to my knowledge. Just wanted to take some proactive steps to when we actually deprecate process.binding

@bnoordhuis
Copy link
Member

Okay, in that case I'm -1 until a reasonable use case pops up. Adding an API is easy but if it turns out to be the wrong API, we're stuck with it. Proactivity is what got us the util.is*() functions.

@evanlucas
Copy link
Contributor Author

Fair enough

@evanlucas evanlucas closed this Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants