From 20cae108b0ab77e125e3aa4c39de742a1db8c42a Mon Sep 17 00:00:00 2001 From: Jakob Moosbrugger <jak.moo54@gmail.com> Date: Thu, 20 Apr 2017 01:36:04 +0200 Subject: [PATCH] option to disable redirection --- lib/index.js | 4 +++- src/index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index a75607e..7a0c861 100644 --- a/lib/index.js +++ b/lib/index.js @@ -31,7 +31,7 @@ var Worker = function () { return (/(debug|inspect)/.test(execArg) ); }); - if (debugVars.length > 0) { + if (debugVars.length > 0 && !options.noDebugRedirection) { if (!options.execArgv) { //if no execArgs are given copy all arguments debugVars = process.execArgv; @@ -69,6 +69,8 @@ var Worker = function () { options.execArgv = options.execArgv.concat(debugVars); } + delete options.noDebugRedirection; + this.child = fork(worker, args, options); this.onerror = undefined; this.onmessage = undefined; diff --git a/src/index.js b/src/index.js index 9f37656..cd9e6f3 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ class Worker { var debugVars = process.execArgv.filter(execArg => { return (/(debug|inspect)/).test(execArg); }); - if (debugVars.length > 0) { + if (debugVars.length > 0 && !options.noDebugRedirection) { if (!options.execArgv) { //if no execArgs are given copy all arguments debugVars = process.execArgv; options.execArgv = []; @@ -50,6 +50,8 @@ class Worker { } + delete options.noDebugRedirection; + this.child = fork(worker, args, options); this.onerror = undefined; this.onmessage = undefined; -- GitLab