Skip to content

Commit bf68cbd

Browse files
lgandeckiljharb
authored andcommitted
[patch] when a non-node fs is broken and lacks realpath/realpathSync, do not crash
1 parent 45d83c0 commit bf68cbd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var nodeModulesPaths = require('./node-modules-paths.js');
55
var normalizeOptions = require('./normalize-options.js');
66
var isCore = require('./is-core');
77

8-
var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
8+
var realpath = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
99

1010
var defaultIsFile = function isFile(file, cb) {
1111
fs.stat(file, function (err, stat) {

lib/sync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var caller = require('./caller.js');
55
var nodeModulesPaths = require('./node-modules-paths.js');
66
var normalizeOptions = require('./normalize-options.js');
77

8-
var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
8+
var realpath = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
99

1010
var defaultIsFile = function isFile(file) {
1111
try {

0 commit comments

Comments
 (0)