Conversation
de167e3 to
c0147e1
Compare
Instead of relying on process.exit() to terminate execution, also explicitly return from methods when errors are encountered. This is more flexible for clients who which to override the methods that use process.exit() in order to use commander in other contexts than the shell
|
This will break the old manner? |
|
@zhiyelee No, this only comes in to play when you override By doing so now you can use commander in contexts other than a shell. |
|
@SomeKittens @zhiyelee Any thoughts? The patch has some added tests. |
|
@zhiyelee what will break? This looks good to me. |
|
@SomeKittens Nothing break. But I'm not a big fan of this. Since to use this, user must override |
|
@zhiyelee I agree its not the most graceful approach when it comes to overriding Even if we do that, we'll still need to implement these changes where program flow is interrupted by returns instead of relying on |
|
I should also mention this patch goes most of the way towards fixing the second Con on this list: http://trentm.com/2014/01/a-critique-of-commander-for-nodejs.html |
|
In addition to the reason of this PR (testing purposes) we have a requirement to apply custom styling for the error messages to make them consistent across our app (e.g. we are using bold red |
|
I'd also like to see this (and preferably a way to pass an exit function to the |
|
I have added this pull request to a triage collection of exit related issues for future reference. This pull request has not had any activity in over six months. It isn't likely to get acted on due to this report. Feel free to open a new issue if it comes up again, with new information and renewed interest. Thank you for your contributions. |
Instead of relying on process.exit() to terminate execution, also explicitly
return from methods when errors are encountered. This is more flexible for
clients who which to override the methods that use process.exit() in order
to use commander in other contexts than the shell
Fixes #443