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

should pass node options or v8 options to the subcommend exec process #877

Closed
fishbar opened this issue Oct 12, 2018 · 9 comments
Closed

Comments

@fishbar
Copy link

fishbar commented Oct 12, 2018

Command.prototype.executeSubCommand = function(argv, args, unknown) {

when subcommand executing, the unknow args will passed to the sub process which spawn by the function above. but if the args is belong to node(

node options or v8 options), it will fail。

for example, when the subcommand deal with something which needs large mem, so we need to setup the v8 options --max_old_space_size =2048, for now the max_old_space_size will be treated
as unknow options, so the process which running the subCommand can not receive these options.

@fishbar
Copy link
Author

fishbar commented Oct 12, 2018

or these node options can be passed by ENV COMMANDER_NODE_OPTIONS

@roman-vanesyan
Copy link
Collaborator

roman-vanesyan commented Oct 24, 2018

Hello there can you please elaborate on it, I'm not sure I have correctly understood you

@fishbar
Copy link
Author

fishbar commented Nov 2, 2018

for example,when the command running with large memory and deep stacks, i need pass v8 options to the node process,like:

> customCmd  subcmd --max_old_space_size=2048 --stack_size=1024  other_options

now commander will treated these v8 options as unknow arguments and passed to the subcmd。
so the v8 options dose’t work, and because of the memory limitation and stack limitation,command never can success.

@erolkskn
Copy link

Hi,

Thanks for pointing that out. I will create a pull request about this.

@shadowspawn
Copy link
Collaborator

@fishbar
Can you use NODE_OPTIONS?

https://nodejs.org/api/cli.html#cli_node_options_options

@shadowspawn
Copy link
Collaborator

@fishbar are you on Windows?

(There is code passing the extra arguments for javascript subcommands when not on Windows.)

@shadowspawn
Copy link
Collaborator

This will hopefully be fixed by #611

@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

Support for passing node options added in v3 (thanks @hxsf): https://github.com/tj/commander.js/releases/tag/v3.0.0

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

4 participants