Skip to content

Commit

Permalink
refactor: do not depend on deprecated constatnts module
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Feb 21, 2021
1 parent 24f88fd commit 45e62bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions polyfills.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var constants = require('constants')
var constants = require('fs').constants

var origCwd = process.cwd
var cwd = null
Expand Down Expand Up @@ -31,7 +31,7 @@ function patch (fs) {

// lchmod, broken prior to 0.6.2
// back-port the fix here.
if (constants.hasOwnProperty('O_SYMLINK') &&
if (constants.O_SYMLINK !== undefined &&
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs)
}
Expand Down Expand Up @@ -199,7 +199,7 @@ function patch (fs) {
}

function patchLutimes (fs) {
if (constants.hasOwnProperty("O_SYMLINK")) {
if (constants.O_SYMLINK !== undefined) {
fs.lutimes = function (path, at, mt, cb) {
fs.open(path, constants.O_SYMLINK, function (er, fd) {
if (er) {
Expand Down

0 comments on commit 45e62bd

Please sign in to comment.