diff --git a/lib/index.js b/lib/index.js index a75607ef5985c2a7275cc79c377e7de347e6424d..7a0c8615411e7d608b92ad7bf336fbb5910dbae7 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 9f37656d62879eb9fe42f6653f73d9a8e689b4c1..cd9e6f39d446b59fa9c7479963e80d3f5c0b2ec1 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;