Skip to content

Commit

Permalink
feat: add an option for turning off Node.js hijacking
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Mar 16, 2022
1 parent a67c926 commit f649e2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions prelude/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const NODE_VERSION_MINOR = process.version.match(/^v\d+.(\d+)/)[1] | 0;
const ARGV0 = process.argv[0];
const EXECPATH = process.execPath;
let ENTRYPOINT = process.argv[1];
let MOCK_NODE = false;

if (process.env.PKG_EXECPATH === 'PKG_INVOKE_NODEJS') {
return { undoPatch: true };
Expand Down Expand Up @@ -1963,7 +1964,7 @@ function payloadFileSync(pointer) {
}
const opts = args[pos];
if (!opts.env) opts.env = _extend({}, process.env);
if (opts.env.PKG_EXECPATH === 'PKG_INVOKE_NODEJS') return;
if (!MOCK_NODE || opts.env.PKG_EXECPATH === 'PKG_INVOKE_NODEJS') return;
opts.env.PKG_EXECPATH = EXECPATH;
}

Expand Down Expand Up @@ -2008,7 +2009,7 @@ function payloadFileSync(pointer) {
}

function modifyShort(args) {
if (!args[0]) return;
if (!MOCK_NODE || !args[0]) return;
if (!Array.isArray(args[1])) {
args.splice(1, 0, []);
}
Expand Down

0 comments on commit f649e2e

Please sign in to comment.