From b7608ac7077f95837c3b9eefdfd04c45b66179fa Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Thu, 6 Apr 2017 10:40:55 -0700 Subject: [PATCH] deps: cherry-pick node-inspect#43 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node 8.x no longer has --debug-brk. Ref: https://github.com/nodejs/node-inspect/pull/43 PR-URL: https://github.com/nodejs/node/pull/11441 Reviewed-By: bnoordhuis - Ben Noordhuis Reviewed-By: joshgav - Josh Gavant Reviewed-By: cjihrig - Colin Ihrig Reviewed-By: targos - Michaƫl Zasso --- deps/node-inspect/lib/_inspect.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deps/node-inspect/lib/_inspect.js b/deps/node-inspect/lib/_inspect.js index ac32e0a6a432fa..7c13ef786e3073 100644 --- a/deps/node-inspect/lib/_inspect.js +++ b/deps/node-inspect/lib/_inspect.js @@ -55,10 +55,11 @@ function getDefaultPort() { function runScript(script, scriptArgs, inspectPort, childPrint) { return new Promise((resolve) => { - const args = [ - '--inspect', - `--debug-brk=${inspectPort}`, - ].concat([script], scriptArgs); + const needDebugBrk = process.version.match(/^v(6|7)\./); + const args = (needDebugBrk ? + ['--inspect', `--debug-brk=${inspectPort}`] : + [`--inspect-brk=${inspectPort}`]) + .concat([script], scriptArgs); const child = spawn(process.execPath, args); child.stdout.setEncoding('utf8'); child.stderr.setEncoding('utf8');