Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
child-process-debug
Advanced tools
Readme
Convenience methods for debugging child processes in Node.JS. Child processes will be started with --debug
if the
parent was started with --debug
and the children will each get their own increasing port number based off the
parent's port number. The default port is 5858. If you add --debug-brk
that will also get passed to the children.
var childProcessDebug = require('child-process-debug');
for (var i = 0; i < 4; i++) {
//if this script wasn't run with --debug this will spawn node example.js [0-3]
//if this script was run with --debug, this will spawn node --debug=[5859-5862] example.js [0-3]
childProcessDebug.spawn(['example.js', i]);
}
This takes the exact same arguments as child_process.spawn
and if the parent had debugging turned on (via --debug),
it'll turn on debugging for the spawned child. command
is also optional (unlike child_process.spawn
) and defaults
to process.execPath
.
The ChildProcess returned from spawn will have a property called debugPort
indicating the debug port chosen for that
child or undefined.
This takes the exact same arguments as child_process.fork
and if the parent had debugging turned on (via --debug),
it'll turn on debugging for the spawned child. Return is the same as spawn
above.
Returns the next debug port that comes after the current process's debug port. If the current process doesn't have
debug turned on then this will return undefined. This is useful if you're not using spawn
and want to specify the
--debug=port
argument yourself.
Kill's the spawned child when the parent dies. This will not work if the parent is killed with SIGKILL.
Returns the current process's debug port or undefined if debug is not turned on.
Returns true if the current process has the flag --debug-brk
.
By James Hartig
FAQs
Convenience methods for debugging child-process
The npm package child-process-debug receives a total of 38 weekly downloads. As such, child-process-debug popularity was classified as not popular.
We found that child-process-debug demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.