npm child-process-debug.
vscode:
-,
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outFiles": [],
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
{
"name": "Attach child",
"type": "node",
"request": "attach",
"port": 5859,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outFiles": [],
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
:
- node
--debug
$ node --debug master.js - Join the
master.jsnode process using Attachthe debug panel - Breakpoint of a place in progress
child.js - Quickly disconnects from the process
mainand joins the process childusingAttach child
For debugging Fro, you can delay message passing between processes with setTimeout
var child = child_process.fork(__dirname + './child.js')
setTimeout(function() {
child.send('...')
}, 5000)
source
share