Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use inspect in git-style mode #838

Closed
renatocassino opened this issue Aug 3, 2018 · 8 comments
Closed

Cannot use inspect in git-style mode #838

renatocassino opened this issue Aug 3, 2018 · 8 comments

Comments

@renatocassino
Copy link

renatocassino commented Aug 3, 2018

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.

@jackellenberger
Copy link

jackellenberger commented Sep 27, 2018

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

@ericnewton76
Copy link

That is how I debug the git-style-subcommands... just point node directly at the subcommand's .js file.

@shadowspawn
Copy link
Collaborator

This looks like might be a solution on node side?

nodejs/node#5025

bind to random port with --debug-port=0

@zcfan
Copy link

zcfan commented Apr 16, 2019

@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?

@zcfan
Copy link

zcfan commented Apr 16, 2019

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.

@shadowspawn
Copy link
Collaborator

Closing this one in favour of #533. Open PR with possible approach is #874.

@shadowspawn
Copy link
Collaborator

This issue will be resolved when v3.0.0 is released. Available now as a prerelease. See #1001

@shadowspawn
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants