{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/782","repository_url":"https://api.github.com/repos/hashicorp/consul-template","labels_url":"https://api.github.com/repos/hashicorp/consul-template/issues/782/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul-template/issues/782/comments","events_url":"https://api.github.com/repos/hashicorp/consul-template/issues/782/events","html_url":"https://github.com/hashicorp/consul-template/issues/782","id":188294033,"number":782,"title":"Exits always with error code 12 when stopped gracefully","user":{"login":"kivoli","id":19862897,"avatar_url":"https://avatars.githubusercontent.com/u/19862897?v=3","gravatar_id":"","url":"https://api.github.com/users/kivoli","html_url":"https://github.com/kivoli","followers_url":"https://api.github.com/users/kivoli/followers","following_url":"https://api.github.com/users/kivoli/following{/other_user}","gists_url":"https://api.github.com/users/kivoli/gists{/gist_id}","starred_url":"https://api.github.com/users/kivoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kivoli/subscriptions","organizations_url":"https://api.github.com/users/kivoli/orgs","repos_url":"https://api.github.com/users/kivoli/repos","events_url":"https://api.github.com/users/kivoli/events{/privacy}","received_events_url":"https://api.github.com/users/kivoli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-09T16:40:45Z","updated_at":"2016-11-10T07:45:43Z","closed_at":null,"body":"### Consul Template version\r\nv0.16.0 (also tested with master)\r\n\r\n### Configuration\r\nN/A\r\n\r\n### Command\r\n\r\n```shell\r\n./consul-template -kill-signal=SIGINT\r\n```\r\n\r\n### Debug output\r\nLast line:\r\n```\r\n[DEBUG] (runner) child is not running\r\n```\r\n\r\n### Expected behavior\r\nIf the appropriate signal is sent to the process (as set per `-kill-signal`) the process should exit with status code 0. This is especially important when using `SIGTERM` in Systemd. According to the documentation, `SIGTERM` is the default signal to gracefully stop consul-template. \r\n\r\n### Actual behavior\r\nRegardless whether the `-kill-signal` option has been specified or not, consul-template always exits with status code 12. \r\n\r\nThis is most likely “as implemented”, see:\r\nhttps://github.com/hashicorp/consul-template/blob/master/cli.go#L143\r\nSnippet:\r\n\r\n```golang\r\n      case config.KillSignal:\r\n        fmt.Fprintf(cli.errStream, \"Cleaning up...\\n\")\r\n        runner.Stop()\r\n        return ExitCodeInterrupt\r\n```\r\nIn my opinion the last line should return `ExitCodeOK` but it may be intended for some reason I’m unaware of. \r\n\r\n### Steps to reproduce\r\n1. Start consul-template with `-kill-signal=SIGINT`\r\n2. Ctrl+C\r\n3. `echo $?`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/consul-template/issues/comments/259622564","html_url":"https://github.com/hashicorp/consul-template/issues/782#issuecomment-259622564","issue_url":"https://api.github.com/repos/hashicorp/consul-template/issues/782","id":259622564,"user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T07:45:43Z","updated_at":"2016-11-10T07:45:43Z","body":"Hi @kivoli \r\n\r\nThank you for opening an issue. This is a tricky one... I see both sides of the argument, but, in general, tools don't exit with 0 when interrupted. I'm going to ask @slackpad and @kyhavlov to weigh in here, because I could be persuaded either way."}}
{"actor":{"display_login":"sethvargo"}}