-
Notifications
You must be signed in to change notification settings - Fork 45
Support for debugging a pid #37
Conversation
@@ -139,6 +92,56 @@ function portIsFree(host, port, timeout = 2000) { | |||
}); | |||
} | |||
|
|||
function runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) { | |||
return portIsFree(inspectHost, inspectPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the port check here so it's skipped for remote debugging. Waiting or the the port to be available doesn't make sense for node inspect <host>:<port>
/node inspect -p <pid>
.
@@ -308,6 +307,22 @@ function parseArgv([target, ...args]) { | |||
port = parseInt(portMatch[1], 10); | |||
script = args[0]; | |||
scriptArgs = args.slice(1); | |||
} else if (args.length === 1 && /^\d+$/.test(args[0]) && target === '-p') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much 1:1 copy of the existing _debugger.js
code.
/cc @nodejs/diagnostics |
Manually tested rebased version against nodejs/node#11431, still works. |
@joshgav If you have some time, this is the last bit that still needs a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM insofar I'm able to judge that.
Thanks! Passes on latest nightly & 7.x, merging. |
Tested against nodejs/node#11431.
On versions of node that don't use the new protocol by default, this test is skipped (and the feature will most likely not work).