module: eliminate double getenv()
`process.env` access results in a synchronous `getenv` call. Cache the first result instead and save one syscall.
This commit is contained in:
parent
9d281934df
commit
4f1ae11a62
@ -515,9 +515,10 @@ Module._initPaths = function() {
|
|||||||
paths.unshift(path.resolve(homeDir, '.node_modules'));
|
paths.unshift(path.resolve(homeDir, '.node_modules'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env['NODE_PATH']) {
|
var nodePath = process.env['NODE_PATH'];
|
||||||
|
if (nodePath) {
|
||||||
var splitter = isWindows ? ';' : ':';
|
var splitter = isWindows ? ';' : ':';
|
||||||
paths = process.env['NODE_PATH'].split(splitter).concat(paths);
|
paths = nodePath.split(splitter).concat(paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
modulePaths = paths;
|
modulePaths = paths;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user