Browse Source

module: eliminate double `getenv()`

`process.env` access results in a synchronous `getenv` call. Cache the
first result instead and save one syscall.
v0.10.30-release
Maciej Małecki 11 years ago
committed by Timothy J Fontaine
parent
commit
4f1ae11a62
  1. 5
      lib/module.js

5
lib/module.js

@ -515,9 +515,10 @@ Module._initPaths = function() {
paths.unshift(path.resolve(homeDir, '.node_modules'));
}
if (process.env['NODE_PATH']) {
var nodePath = process.env['NODE_PATH'];
if (nodePath) {
var splitter = isWindows ? ';' : ':';
paths = process.env['NODE_PATH'].split(splitter).concat(paths);
paths = nodePath.split(splitter).concat(paths);
}
modulePaths = paths;

Loading…
Cancel
Save