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

Using 'filter' (or other native array methods) as a command causing error #248

Closed
jonathanrdelgado opened this issue Sep 2, 2014 · 2 comments · Fixed by #249
Closed
Labels
bug Commander is not working as intended

Comments

@jonathanrdelgado
Copy link
Contributor

Came across an error today when using filter as a command input.

Simple reproduction:

com.command('seed <tpl>')
    .action(function(tpl){});

Just running the command <script> seed filter will cause a module not found error, no special coding required.

Error: Cannot find module 'c:\Users\...\bin\cmd-filter'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

It is caused by line 380 of commander's index.js - Even if the this._execs array is empty, calling this._execs['filter'] will return the native function, thus causing the argument to be true and creating this error.

Best solution in my opinion is double checking the value to make sure it is not a function. If you would like, I can throw in a PR.

Thank you for your time.

@thethomaseffect
Copy link
Collaborator

Absolutely, good catch! 👍

@startswithaj
Copy link
Contributor

Resolves #206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Commander is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants