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

fix: avoid relying on Node’s internals #166

Merged
merged 1 commit into from Jan 28, 2018
Merged

Conversation

addaleax
Copy link
Contributor

process.binding() is an internal API of Node, and
its use should be avoided.

Modern versions of Node have constants properties
on the individual public modules, so using these
and falling back to the process.binding() path
ensures that this module is unaffected by
changes to Node’s internals.

`process.binding()` is an internal API of Node, and
its use should be avoided.

Modern versions of Node have `constants` properties
on the individual public modules, so using these
and falling back to the `process.binding()` path
ensures that this module is unaffected by
changes to Node’s internals.
@@ -289,7 +292,7 @@ function fileSync(options) {
var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
/* istanbul ignore else */
if (opts.discardDescriptor) {
fs.closeSync(fd);
fs.closeSync(fd);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an editor-generated change, let me know if you want me to remove it from this patch

Copy link
Owner

Choose a reason for hiding this comment

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

No, this is fine, thank you!

@@ -289,7 +292,7 @@ function fileSync(options) {
var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
/* istanbul ignore else */
if (opts.discardDescriptor) {
fs.closeSync(fd);
fs.closeSync(fd);
Copy link
Owner

Choose a reason for hiding this comment

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

No, this is fine, thank you!

@raszi raszi merged commit 2df2d04 into raszi:master Jan 28, 2018
@raszi raszi changed the title Avoid relying on Node’s internals fix: avoid relying on Node’s internals Aug 29, 2018
@addaleax addaleax deleted the no-binding branch March 21, 2019 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants