Skip to content

Commit

Permalink
Merge pull request #166 from addaleax/no-binding
Browse files Browse the repository at this point in the history
Avoid relying on Node’s internals
  • Loading branch information
raszi authored Jan 28, 2018
2 parents 89d3114 + f2609c9 commit 2df2d04
Showing 1 changed file with 5 additions and 2 deletions.
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);
fd = undefined;
}

Expand Down

0 comments on commit 2df2d04

Please sign in to comment.