{"action":"created","issue":{"url":"https://api.github.com/repos/spf13/hugo/issues/740","labels_url":"https://api.github.com/repos/spf13/hugo/issues/740/labels{/name}","comments_url":"https://api.github.com/repos/spf13/hugo/issues/740/comments","events_url":"https://api.github.com/repos/spf13/hugo/issues/740/events","html_url":"https://github.com/spf13/hugo/issues/740","id":52902940,"number":740,"title":"Hugo should exit with an error code in case of errors when building a website","user":{"login":"anthonyfok","id":1274764,"avatar_url":"https://avatars.githubusercontent.com/u/1274764?v=3","gravatar_id":"","url":"https://api.github.com/users/anthonyfok","html_url":"https://github.com/anthonyfok","followers_url":"https://api.github.com/users/anthonyfok/followers","following_url":"https://api.github.com/users/anthonyfok/following{/other_user}","gists_url":"https://api.github.com/users/anthonyfok/gists{/gist_id}","starred_url":"https://api.github.com/users/anthonyfok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthonyfok/subscriptions","organizations_url":"https://api.github.com/users/anthonyfok/orgs","repos_url":"https://api.github.com/users/anthonyfok/repos","events_url":"https://api.github.com/users/anthonyfok/events{/privacy}","received_events_url":"https://api.github.com/users/anthonyfok/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spf13/hugo/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-12-26T14:13:15Z","updated_at":"2015-04-08T05:07:22Z","closed_at":null,"body":"To help notify the user of problems when Hugo is run as an automated script on the web server, I think Hugo should exit with an error code if there are warnings/errors when building a website.\r\n\r\nFor example, due to a bug either in Hugo docs or in the source code, some error messages are displayed during a `hugo` run:\r\n\r\n```\r\n$ cd ~/git/hugo/docs\r\n$ hugo\r\nERROR: 2014/12/26 Two or more menu items have the same name/identifier in \"<map[interface {}]interface {} Value>\" Menu. Identified as \"Overview\".\r\n Rename or set a unique identifier. \r\nERROR: 2014/12/26 Two or more menu items have the same name/identifier in \"<map[interface {}]interface {} Value>\" Menu. Identified as \"Ordering\".\r\n Rename or set a unique identifier. \r\n0 draft content \r\n0 future content \r\n87 pages created \r\n15 tags created\r\n0 groups created\r\nin 214 ms\r\n$ echo $?\r\n0\r\n```\r\n\r\nThe fact that the above returns an error code of 0 means that most automatic deployment scripts (except the really smart ones who grep strings like `ERROR` and `WARNING` in the `hugo` output)  would fail to detect any errors, leaving potential build problems undetected."},"comment":{"url":"https://api.github.com/repos/spf13/hugo/issues/comments/90802916","html_url":"https://github.com/spf13/hugo/issues/740#issuecomment-90802916","issue_url":"https://api.github.com/repos/spf13/hugo/issues/740","id":90802916,"user":{"login":"alaska","id":926884,"avatar_url":"https://avatars.githubusercontent.com/u/926884?v=3","gravatar_id":"","url":"https://api.github.com/users/alaska","html_url":"https://github.com/alaska","followers_url":"https://api.github.com/users/alaska/followers","following_url":"https://api.github.com/users/alaska/following{/other_user}","gists_url":"https://api.github.com/users/alaska/gists{/gist_id}","starred_url":"https://api.github.com/users/alaska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alaska/subscriptions","organizations_url":"https://api.github.com/users/alaska/orgs","repos_url":"https://api.github.com/users/alaska/repos","events_url":"https://api.github.com/users/alaska/events{/privacy}","received_events_url":"https://api.github.com/users/alaska/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T05:07:22Z","updated_at":"2015-04-08T05:07:22Z","body":"It seems like there are two solutions to this problem:\r\n1. Audit the code, identifying all notable errors and setting a flag\r\n2. Patch [jww](https://github.com/spf13/jWalterWeatherman) to (optionally?) track whether or not an ERROR, CRITICAL or FATAL has been emitted and then use that to determine exit code.\r\n\r\nNumber 2 is certainly the easiest solution, but it would necessitate an issue there. Thoughts?\r\n"}}