diff --git a/lib/fs.js b/lib/fs.js index d390335df8c72c..50d6afc8b41e08 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1550,7 +1550,7 @@ fs.realpathSync = function realpathSync(p, cache) { } } if (linkTarget === null) { - fs.accessSync(base, fs.F_OK); // Throws ELOOP on cyclic links. + fs.statSync(base); linkTarget = fs.readlinkSync(base); } resolvedLink = pathModule.resolve(previous, linkTarget); diff --git a/lib/module.js b/lib/module.js index ca2c805bb0da16..a068bffa7d9056 100644 --- a/lib/module.js +++ b/lib/module.js @@ -428,14 +428,14 @@ Module.prototype._compile = function(content, filename) { // Native extension for .js Module._extensions['.js'] = function(module, filename) { - var content = internalModuleReadFile(filename); + var content = fs.readFileSync(filename, 'utf8'); module._compile(internalModule.stripBOM(content), filename); }; // Native extension for .json Module._extensions['.json'] = function(module, filename) { - var content = internalModuleReadFile(filename); + var content = fs.readFileSync(filename, 'utf8'); try { module.exports = JSON.parse(internalModule.stripBOM(content)); } catch (err) {