diff --git a/lib/index.js b/lib/index.js
index 8e8be3252b5b017b88f3ee8158e4ee7bc285b286..301967cc6b9f3d77d64ac87d3e33bb07f04a61bc 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -25,6 +25,31 @@ var Worker = function () {
 			options.cwd = process.cwd();
 		}
 
+		//get all debug related parameters
+		var debugVars = process.execArgv.filter(function (execArg) {
+			return (/(debug|inspect)/.test(execArg)
+			);
+		});
+		if (debugVars.lenght > 0) {
+			if (!options.execArgv) {
+				//if no execArgs are given copy all arguments
+				debugVars = process.execArgv;
+				options.execArgv = [];
+			}
+
+			var portIndex = debugVars.findIndex(function (debugArg) {
+				//get index of debug port specifier
+				return (/^--(debug|inspect)(-brk)?=\d*/.test(debugArg)
+				);
+			});
+
+			if (portIndex > 0) {
+				//set new port, ignore "-brk", it doesn't work
+				debugVars[portIndex] = (/^--debug/.test(debugVars[portIndex]) ? "--debug=" : "--inspect=") + process.debugPort + 1;
+			}
+			options.execArgv = options.execArgv.concat(debugVars);
+		}
+
 		this.child = fork(worker, args, options);
 		this.onerror = undefined;
 		this.onmessage = undefined;
diff --git a/src/index.js b/src/index.js
index d3de0371803876474728ff539ca2bc1243142041..57783098695449df3522c412eb794678a8932731 100644
--- a/src/index.js
+++ b/src/index.js
@@ -12,6 +12,27 @@ class Worker {
 			options.cwd = process.cwd();
 		}
 
+		//get all debug related parameters
+		var debugVars = process.execArgv.filter(execArg => {
+			return (/(debug|inspect)/).test(execArg);
+		});
+		if (debugVars.lenght > 0) {
+			if (!options.execArgv) { //if no execArgs are given copy all arguments
+				debugVars = process.execArgv;
+				options.execArgv = [];
+			}
+
+			let portIndex = debugVars.findIndex(debugArg => { //get index of debug port specifier
+				return (/^--(debug|inspect)(-brk)?\d*/).test(debugArg);
+			});
+
+			if (portIndex > 0) { //set new port, ignore "-brk", it doesn't work
+				debugVars[portIndex] = ((/^--debug/).test(debugVars[portIndex]) ? "--debug=" : "--inspect=") + process.debugPort + 1;
+			}
+			options.execArgv = options.execArgv.concat(debugVars);
+
+		}
+
 		this.child = fork(worker, args, options);
 		this.onerror = undefined;
 		this.onmessage = undefined;