summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js')
-rw-r--r--deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js34
1 files changed, 25 insertions, 9 deletions
diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js
index 92b8d7dc3d..56f31e4712 100644
--- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js
+++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js
@@ -1,14 +1,16 @@
'use strict';
-var path = require('path');
-var pathKey = require('path-key');
+const path = require('path');
+const pathKey = require('path-key');
-module.exports = function (opts) {
- opts = opts || {};
+module.exports = opts => {
+ opts = Object.assign({
+ cwd: process.cwd(),
+ path: process.env[pathKey()]
+ }, opts);
- var prev;
- var pth = path.resolve(opts.cwd || '.');
-
- var ret = [];
+ let prev;
+ let pth = path.resolve(opts.cwd);
+ const ret = [];
while (prev !== pth) {
ret.push(path.join(pth, 'node_modules/.bin'));
@@ -19,5 +21,19 @@ module.exports = function (opts) {
// ensure the running `node` binary is used
ret.push(path.dirname(process.execPath));
- return ret.concat(opts.path || process.env[pathKey()]).join(path.delimiter);
+ return ret.concat(opts.path).join(path.delimiter);
+};
+
+module.exports.env = opts => {
+ opts = Object.assign({
+ env: process.env
+ }, opts);
+
+ const env = Object.assign({}, opts.env);
+ const path = pathKey({env});
+
+ opts.path = env[path];
+ env[path] = module.exports(opts);
+
+ return env;
};