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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/tmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
* Module dependencies.
*/
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('crypto');
const osTmpDir = require('os-tmpdir');
const _c = process.binding('constants');
const _c = fs.constants && os.constants ?
{ fs: fs.constants, os: os.constants } :
process.binding('constants');

/*
* The working inner variables.
Expand Down Expand Up @@ -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!

fd = undefined;
}

Expand Down