{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/now-cli/issues/1194","repository_url":"https://api.github.com/repos/zeit/now-cli","labels_url":"https://api.github.com/repos/zeit/now-cli/issues/1194/labels{/name}","comments_url":"https://api.github.com/repos/zeit/now-cli/issues/1194/comments","events_url":"https://api.github.com/repos/zeit/now-cli/issues/1194/events","html_url":"https://github.com/zeit/now-cli/issues/1194","id":305703302,"number":1194,"title":"Instead of using `await exit()` or invoking `process.exit()` directly, use return values","user":{"login":"rauchg","id":13041,"avatar_url":"https://avatars0.githubusercontent.com/u/13041?v=4","gravatar_id":"","url":"https://api.github.com/users/rauchg","html_url":"https://github.com/rauchg","followers_url":"https://api.github.com/users/rauchg/followers","following_url":"https://api.github.com/users/rauchg/following{/other_user}","gists_url":"https://api.github.com/users/rauchg/gists{/gist_id}","starred_url":"https://api.github.com/users/rauchg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauchg/subscriptions","organizations_url":"https://api.github.com/users/rauchg/orgs","repos_url":"https://api.github.com/users/rauchg/repos","events_url":"https://api.github.com/users/rauchg/events{/privacy}","received_events_url":"https://api.github.com/users/rauchg/received_events","type":"User","site_admin":false},"labels":[{"id":681742717,"url":"https://api.github.com/repos/zeit/now-cli/labels/enhancement","name":"enhancement","color":"ededed","default":true},{"id":439305934,"url":"https://api.github.com/repos/zeit/now-cli/labels/good%20first%20contribution","name":"good first contribution","color":"128A0C","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-15T20:13:23Z","updated_at":"2018-03-16T08:05:54Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"In many parts of the codebase we use:\r\n\r\n```js\r\nif (error) {\r\n  // something\r\n  process.exit(1)\r\n}\r\n```\r\n\r\nHowever, the current design of the CLI is that each sub-command has a C-style `main` function, configured to be `async`, whose *return value* is used as the exit code.\r\n\r\nThis makes writing tests and writing cleaner code a lot easier. Instead, we should be using:\r\n\r\n```js\r\nif (error) {\r\n  // something\r\n  return 1\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/zeit/now-cli/issues/comments/373634937","html_url":"https://github.com/zeit/now-cli/issues/1194#issuecomment-373634937","issue_url":"https://api.github.com/repos/zeit/now-cli/issues/1194","id":373634937,"user":{"login":"riddla","id":174157,"avatar_url":"https://avatars1.githubusercontent.com/u/174157?v=4","gravatar_id":"","url":"https://api.github.com/users/riddla","html_url":"https://github.com/riddla","followers_url":"https://api.github.com/users/riddla/followers","following_url":"https://api.github.com/users/riddla/following{/other_user}","gists_url":"https://api.github.com/users/riddla/gists{/gist_id}","starred_url":"https://api.github.com/users/riddla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riddla/subscriptions","organizations_url":"https://api.github.com/users/riddla/orgs","repos_url":"https://api.github.com/users/riddla/repos","events_url":"https://api.github.com/users/riddla/events{/privacy}","received_events_url":"https://api.github.com/users/riddla/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T08:05:53Z","updated_at":"2018-03-16T08:05:53Z","author_association":"CONTRIBUTOR","body":"@rauchg, I also found the pattern `return process.exit(1)` in the `scale` command – as the process will be terminated directly that also makes no sense, or am I mistaken? These should be replaced also in my opinion. What do you think? "}}
{"actor":{"display_login":"riddla"}}