Hello guys.
Isn't possible to use the debugger with inspect.
Example:
program
.version(version)
.command('command1', 'command').alias('c1')
.parse(process.argv);
In file index-command1.js:
const a = 1;
debugger
const b = 2;
And run: node --inspect index.js command1.
I know that the git style is a child_process. But is possible to pass the --inspect to another command?
Thanks for this.
I have the same issue.
The not ideal but not so bad is just to call your sub-command file directly, e.g. node inspect program-subcommand.js --option --options
That is how I debug the git-style-subcommands... just point node directly at the subcommand's .js file.
This looks like might be a solution on node side?
nodejs/node#5025
bind to random port with --debug-port=0
@shadowspawn After reading the link you provide I didn't realize how it can help this situation. Is the --debug-port option assigning a random port to the new created child process?
Oh I didn't notice the reference before your comment. increment debug port looks good to me, finding the subcommand binary path and execute works but tedious.
Closing this one in favour of #533. Open PR with possible approach is #874.
This issue will be resolved when v3.0.0 is released. Available now as a prerelease. See #1001
If you are using the node inspector for debugging git-style executable (sub)commands using node -inspect et al, the inspector port is incremented by 1 for the spawned subcommand.
Shipped in v3: https://github.com/tj/commander.js/releases/tag/v3.0.0
Thanks to suggestion by @tcf909
Most helpful comment
That is how I debug the git-style-subcommands... just point node directly at the subcommand's .js file.