{"action":"created","issue":{"url":"https://api.github.com/repos/tj/commander.js/issues/444","labels_url":"https://api.github.com/repos/tj/commander.js/issues/444/labels{/name}","comments_url":"https://api.github.com/repos/tj/commander.js/issues/444/comments","events_url":"https://api.github.com/repos/tj/commander.js/issues/444/events","html_url":"https://github.com/tj/commander.js/pull/444","id":109169786,"number":444,"title":"Explicitly return from error methods","user":{"login":"plemarquand","id":667875,"avatar_url":"https://avatars.githubusercontent.com/u/667875?v=3","gravatar_id":"","url":"https://api.github.com/users/plemarquand","html_url":"https://github.com/plemarquand","followers_url":"https://api.github.com/users/plemarquand/followers","following_url":"https://api.github.com/users/plemarquand/following{/other_user}","gists_url":"https://api.github.com/users/plemarquand/gists{/gist_id}","starred_url":"https://api.github.com/users/plemarquand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plemarquand/subscriptions","organizations_url":"https://api.github.com/users/plemarquand/orgs","repos_url":"https://api.github.com/users/plemarquand/repos","events_url":"https://api.github.com/users/plemarquand/events{/privacy}","received_events_url":"https://api.github.com/users/plemarquand/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-30T20:12:11Z","updated_at":"2015-10-06T13:45:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tj/commander.js/pulls/444","html_url":"https://github.com/tj/commander.js/pull/444","diff_url":"https://github.com/tj/commander.js/pull/444.diff","patch_url":"https://github.com/tj/commander.js/pull/444.patch"},"body":"Instead of relying on process.exit() to terminate execution, also explicitly\r\nreturn from methods when errors are encountered. This is more flexible for\r\nclients who which to override the methods that use process.exit() in order\r\nto use commander in other contexts than the shell\r\n\r\nFixes #443"},"comment":{"url":"https://api.github.com/repos/tj/commander.js/issues/comments/145860624","html_url":"https://github.com/tj/commander.js/pull/444#issuecomment-145860624","issue_url":"https://api.github.com/repos/tj/commander.js/issues/444","id":145860624,"user":{"login":"plemarquand","id":667875,"avatar_url":"https://avatars.githubusercontent.com/u/667875?v=3","gravatar_id":"","url":"https://api.github.com/users/plemarquand","html_url":"https://github.com/plemarquand","followers_url":"https://api.github.com/users/plemarquand/followers","following_url":"https://api.github.com/users/plemarquand/following{/other_user}","gists_url":"https://api.github.com/users/plemarquand/gists{/gist_id}","starred_url":"https://api.github.com/users/plemarquand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plemarquand/subscriptions","organizations_url":"https://api.github.com/users/plemarquand/orgs","repos_url":"https://api.github.com/users/plemarquand/repos","events_url":"https://api.github.com/users/plemarquand/events{/privacy}","received_events_url":"https://api.github.com/users/plemarquand/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T13:45:40Z","updated_at":"2015-10-06T13:45:40Z","body":"@zhiyelee I agree its not the most graceful approach when it comes to overriding `process.exit`. A better one long term would be centralizing all the `process.exit`s into a single method that can then be overridden, and passing to that method the exit code as well as error message. The default approach, as it is now, would be to print that message and exit. However then if you wanted to do something else like forward the message to a remote client, you could do so.\r\n\r\nEven if we do that, we'll still need to implement these changes where program flow is interrupted by returns instead of relying on `process.exit` to do it for us."}}