Skip to content

Commit

Permalink
[patch] when a non-node fs is broken and lacks realpath/`realpath…
Browse files Browse the repository at this point in the history
…Sync`, do not crash (browserify#220)
  • Loading branch information
lgandecki authored and ljharb committed Apr 16, 2020
1 parent 301c07d commit 782dfec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var nodeModulesPaths = require('./node-modules-paths.js');
var normalizeOptions = require('./normalize-options.js');
var isCore = require('./is-core');

var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
var realpath = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;

var defaultIsFile = function isFile(file, cb) {
fs.stat(file, function (err, stat) {
Expand Down
2 changes: 1 addition & 1 deletion lib/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var caller = require('./caller.js');
var nodeModulesPaths = require('./node-modules-paths.js');
var normalizeOptions = require('./normalize-options.js');

var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
var realpath = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;

var defaultIsFile = function isFile(file) {
try {
Expand Down

0 comments on commit 782dfec

Please sign in to comment.