From a3b418c546c77cebf2ccbdbf934e43d5957d7292 Mon Sep 17 00:00:00 2001 From: Vasiliy Matyushin Date: Fri, 30 Nov 2018 02:56:06 +0500 Subject: [PATCH 1/2] Avoid including node binary path if it already present To preventing override user order in PATH(which used in version managers, example, rvm(ruby version manager)) --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 56f31e4..37d4a3c 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,11 @@ module.exports = opts => { } // ensure the running `node` binary is used - ret.push(path.dirname(process.execPath)); + const binNodePth = path.dirname(process.execPath) + const testExisting = new RegExp(`:${binNodePth}:`) + if(!testExisting.test(opts.path)) { + ret.push(binNodePth); + } return ret.concat(opts.path).join(path.delimiter); }; From 778bc5f5723ea921fdebf02f23eb4b92a45fc559 Mon Sep 17 00:00:00 2001 From: Vasiliy Matyushin Date: Fri, 30 Nov 2018 03:02:18 +0500 Subject: [PATCH 2/2] fix missed semicolon and space --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 37d4a3c..54c2679 100644 --- a/index.js +++ b/index.js @@ -19,9 +19,9 @@ module.exports = opts => { } // ensure the running `node` binary is used - const binNodePth = path.dirname(process.execPath) - const testExisting = new RegExp(`:${binNodePth}:`) - if(!testExisting.test(opts.path)) { + const binNodePth = path.dirname(process.execPath); + const testExisting = new RegExp(`:${binNodePth}:`); + if (!testExisting.test(opts.path)) { ret.push(binNodePth); }