Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent fork from adding --inspect-brk

Tags:

node.js

My application calls child_process.fork during execution. I would like to use --inspect-brk to debug the tests, but I do not care about the forked process. I actually specifically need the forked process to not inherit the --inspect-brk flag. How can I do that?

like image 416
Breedly Avatar asked Jun 29 '26 14:06

Breedly


1 Answers

From the child process docs, for child_process.fork:

execArgv List of string arguments passed to the executable. Default: process.execArgv

So, the forked process inherits the main process arguments passed. With that in mind, you should override execArgv:

var cp = require('child_process');
var foo = cp.fork('./foo.js', { execArgv: [] });
like image 107
Daniel Conde Marin Avatar answered Jul 04 '26 11:07

Daniel Conde Marin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!