{"action":"closed","number":2803,"pull_request":{"url":"https://api.github.com/repos/lxc/lxd/pulls/2803","id":102364430,"html_url":"https://github.com/lxc/lxd/pull/2803","diff_url":"https://github.com/lxc/lxd/pull/2803.diff","patch_url":"https://github.com/lxc/lxd/pull/2803.patch","issue_url":"https://api.github.com/repos/lxc/lxd/issues/2803","number":2803,"state":"closed","locked":false,"title":"exec: report exit code when we got killed by signal","user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"body":"The standard shell convention is to report 128 + n where n := signal that killed\r\nthe process. This signal number is usually within a reasonable range so that the\r\nmagic 8-bit wall of sound is not breached. Essentially, we now report exit codes\r\nlike a standard shell would:\r\n\r\n1.\r\n\tchb@conventiont|~/source/go/bin\r\n\t> ./lxc exec zest1 sleep 100\r\n\tchb@conventiont|~/source/go/bin\r\n\t> echo $?\r\n\t143\r\n\r\ncaused by sending:\r\n\r\n\tkill -15 $(pidof sleep 100)\r\n\r\n2.\r\n\tchb@conventiont|~/source/go/bin\r\n\t> ./lxc exec zest1 sleep 100\r\n\tchb@conventiont|~/source/go/bin\r\n\t> echo $?\r\n\t129\r\n\r\ncaused by sending:\r\n\r\n\tkill -HUP $(pidof sleep 100)\r\n\r\n3.\r\n\tchb@conventiont|~/source/go/bin\r\n\t> ./lxc exec zest1 sleep 100\r\n\tchb@conventiont|~/source/go/bin\r\n\t> echo $?\r\n\t137\r\n\r\ncaused by sending:\r\n\r\n\tkill -KILL $(pidof sleep 100)\r\n\r\nThis is way more fine-grained than what ssh does and more in line with standard\r\nshell exit codes. Also, this allows us to even report back SIGKILL in the sense\r\nthat we can tell the user, \"Hey, this was the grim 137 aka the ultimate 9.\".\r\n\r\nNote that there is a caveat: If a user were to write a program that uses one of\r\nthose 128 + n exit codes as exit code than being killed by a signal would be\r\nindistinguishable for him from success. However, the user would face the same\r\nproblem running the program in a local shell or otherwise. So I wouldn't count\r\nthis as a counter-argument. (Also, there is the fact that these exit codes are\r\nactually reserved.)\r\n\r\nSigned-off-by: Christian Brauner <christian.brauner@ubuntu.com>","created_at":"2017-01-19T22:42:45Z","updated_at":"2017-01-20T02:27:58Z","closed_at":"2017-01-20T02:27:58Z","merged_at":"2017-01-20T02:27:58Z","merge_commit_sha":"070a68a342601b6179c3f972d38f5459f050e7c8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lxc/lxd/pulls/2803/commits","review_comments_url":"https://api.github.com/repos/lxc/lxd/pulls/2803/comments","review_comment_url":"https://api.github.com/repos/lxc/lxd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lxc/lxd/issues/2803/comments","statuses_url":"https://api.github.com/repos/lxc/lxd/statuses/3132d618306c3f5349be16d879feca7ccd285020","head":{"label":"brauner:2017-01-19/exec_signal_backwarding","ref":"2017-01-19/exec_signal_backwarding","sha":"3132d618306c3f5349be16d879feca7ccd285020","user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"repo":{"id":67736764,"name":"lxd","full_name":"brauner/lxd","owner":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brauner/lxd","description":"Daemon based on liblxc offering a REST API to manage containers","fork":true,"url":"https://api.github.com/repos/brauner/lxd","forks_url":"https://api.github.com/repos/brauner/lxd/forks","keys_url":"https://api.github.com/repos/brauner/lxd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brauner/lxd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brauner/lxd/teams","hooks_url":"https://api.github.com/repos/brauner/lxd/hooks","issue_events_url":"https://api.github.com/repos/brauner/lxd/issues/events{/number}","events_url":"https://api.github.com/repos/brauner/lxd/events","assignees_url":"https://api.github.com/repos/brauner/lxd/assignees{/user}","branches_url":"https://api.github.com/repos/brauner/lxd/branches{/branch}","tags_url":"https://api.github.com/repos/brauner/lxd/tags","blobs_url":"https://api.github.com/repos/brauner/lxd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brauner/lxd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brauner/lxd/git/refs{/sha}","trees_url":"https://api.github.com/repos/brauner/lxd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brauner/lxd/statuses/{sha}","languages_url":"https://api.github.com/repos/brauner/lxd/languages","stargazers_url":"https://api.github.com/repos/brauner/lxd/stargazers","contributors_url":"https://api.github.com/repos/brauner/lxd/contributors","subscribers_url":"https://api.github.com/repos/brauner/lxd/subscribers","subscription_url":"https://api.github.com/repos/brauner/lxd/subscription","commits_url":"https://api.github.com/repos/brauner/lxd/commits{/sha}","git_commits_url":"https://api.github.com/repos/brauner/lxd/git/commits{/sha}","comments_url":"https://api.github.com/repos/brauner/lxd/comments{/number}","issue_comment_url":"https://api.github.com/repos/brauner/lxd/issues/comments{/number}","contents_url":"https://api.github.com/repos/brauner/lxd/contents/{+path}","compare_url":"https://api.github.com/repos/brauner/lxd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brauner/lxd/merges","archive_url":"https://api.github.com/repos/brauner/lxd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brauner/lxd/downloads","issues_url":"https://api.github.com/repos/brauner/lxd/issues{/number}","pulls_url":"https://api.github.com/repos/brauner/lxd/pulls{/number}","milestones_url":"https://api.github.com/repos/brauner/lxd/milestones{/number}","notifications_url":"https://api.github.com/repos/brauner/lxd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brauner/lxd/labels{/name}","releases_url":"https://api.github.com/repos/brauner/lxd/releases{/id}","deployments_url":"https://api.github.com/repos/brauner/lxd/deployments","created_at":"2016-09-08T20:11:08Z","updated_at":"2016-09-08T20:11:10Z","pushed_at":"2017-01-19T22:42:19Z","git_url":"git://github.com/brauner/lxd.git","ssh_url":"git@github.com:brauner/lxd.git","clone_url":"https://github.com/brauner/lxd.git","svn_url":"https://github.com/brauner/lxd","homepage":"https://linuxcontainers.org/lxd","size":8841,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lxc:master","ref":"master","sha":"e9001912d4c6f26490b0213b477e388e3858f1f8","user":{"login":"lxc","id":2301756,"avatar_url":"https://avatars.githubusercontent.com/u/2301756?v=3","gravatar_id":"","url":"https://api.github.com/users/lxc","html_url":"https://github.com/lxc","followers_url":"https://api.github.com/users/lxc/followers","following_url":"https://api.github.com/users/lxc/following{/other_user}","gists_url":"https://api.github.com/users/lxc/gists{/gist_id}","starred_url":"https://api.github.com/users/lxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lxc/subscriptions","organizations_url":"https://api.github.com/users/lxc/orgs","repos_url":"https://api.github.com/users/lxc/repos","events_url":"https://api.github.com/users/lxc/events{/privacy}","received_events_url":"https://api.github.com/users/lxc/received_events","type":"Organization","site_admin":false},"repo":{"id":26192117,"name":"lxd","full_name":"lxc/lxd","owner":{"login":"lxc","id":2301756,"avatar_url":"https://avatars.githubusercontent.com/u/2301756?v=3","gravatar_id":"","url":"https://api.github.com/users/lxc","html_url":"https://github.com/lxc","followers_url":"https://api.github.com/users/lxc/followers","following_url":"https://api.github.com/users/lxc/following{/other_user}","gists_url":"https://api.github.com/users/lxc/gists{/gist_id}","starred_url":"https://api.github.com/users/lxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lxc/subscriptions","organizations_url":"https://api.github.com/users/lxc/orgs","repos_url":"https://api.github.com/users/lxc/repos","events_url":"https://api.github.com/users/lxc/events{/privacy}","received_events_url":"https://api.github.com/users/lxc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lxc/lxd","description":"Daemon based on liblxc offering a REST API to manage containers","fork":false,"url":"https://api.github.com/repos/lxc/lxd","forks_url":"https://api.github.com/repos/lxc/lxd/forks","keys_url":"https://api.github.com/repos/lxc/lxd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lxc/lxd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lxc/lxd/teams","hooks_url":"https://api.github.com/repos/lxc/lxd/hooks","issue_events_url":"https://api.github.com/repos/lxc/lxd/issues/events{/number}","events_url":"https://api.github.com/repos/lxc/lxd/events","assignees_url":"https://api.github.com/repos/lxc/lxd/assignees{/user}","branches_url":"https://api.github.com/repos/lxc/lxd/branches{/branch}","tags_url":"https://api.github.com/repos/lxc/lxd/tags","blobs_url":"https://api.github.com/repos/lxc/lxd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lxc/lxd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lxc/lxd/git/refs{/sha}","trees_url":"https://api.github.com/repos/lxc/lxd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lxc/lxd/statuses/{sha}","languages_url":"https://api.github.com/repos/lxc/lxd/languages","stargazers_url":"https://api.github.com/repos/lxc/lxd/stargazers","contributors_url":"https://api.github.com/repos/lxc/lxd/contributors","subscribers_url":"https://api.github.com/repos/lxc/lxd/subscribers","subscription_url":"https://api.github.com/repos/lxc/lxd/subscription","commits_url":"https://api.github.com/repos/lxc/lxd/commits{/sha}","git_commits_url":"https://api.github.com/repos/lxc/lxd/git/commits{/sha}","comments_url":"https://api.github.com/repos/lxc/lxd/comments{/number}","issue_comment_url":"https://api.github.com/repos/lxc/lxd/issues/comments{/number}","contents_url":"https://api.github.com/repos/lxc/lxd/contents/{+path}","compare_url":"https://api.github.com/repos/lxc/lxd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lxc/lxd/merges","archive_url":"https://api.github.com/repos/lxc/lxd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lxc/lxd/downloads","issues_url":"https://api.github.com/repos/lxc/lxd/issues{/number}","pulls_url":"https://api.github.com/repos/lxc/lxd/pulls{/number}","milestones_url":"https://api.github.com/repos/lxc/lxd/milestones{/number}","notifications_url":"https://api.github.com/repos/lxc/lxd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lxc/lxd/labels{/name}","releases_url":"https://api.github.com/repos/lxc/lxd/releases{/id}","deployments_url":"https://api.github.com/repos/lxc/lxd/deployments","created_at":"2014-11-04T22:40:52Z","updated_at":"2017-01-19T12:37:13Z","pushed_at":"2017-01-20T02:27:58Z","git_url":"git://github.com/lxc/lxd.git","ssh_url":"git@github.com:lxc/lxd.git","clone_url":"https://github.com/lxc/lxd.git","svn_url":"https://github.com/lxc/lxd","homepage":"https://linuxcontainers.org/lxd","size":8704,"stargazers_count":1210,"watchers_count":1210,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"open_issues_count":69,"forks":264,"open_issues":69,"watchers":1210,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lxc/lxd/pulls/2803"},"html":{"href":"https://github.com/lxc/lxd/pull/2803"},"issue":{"href":"https://api.github.com/repos/lxc/lxd/issues/2803"},"comments":{"href":"https://api.github.com/repos/lxc/lxd/issues/2803/comments"},"review_comments":{"href":"https://api.github.com/repos/lxc/lxd/pulls/2803/comments"},"review_comment":{"href":"https://api.github.com/repos/lxc/lxd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lxc/lxd/pulls/2803/commits"},"statuses":{"href":"https://api.github.com/repos/lxc/lxd/statuses/3132d618306c3f5349be16d879feca7ccd285020"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"stgraber","id":2230599,"avatar_url":"https://avatars.githubusercontent.com/u/2230599?v=3","gravatar_id":"","url":"https://api.github.com/users/stgraber","html_url":"https://github.com/stgraber","followers_url":"https://api.github.com/users/stgraber/followers","following_url":"https://api.github.com/users/stgraber/following{/other_user}","gists_url":"https://api.github.com/users/stgraber/gists{/gist_id}","starred_url":"https://api.github.com/users/stgraber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stgraber/subscriptions","organizations_url":"https://api.github.com/users/stgraber/orgs","repos_url":"https://api.github.com/users/stgraber/repos","events_url":"https://api.github.com/users/stgraber/events{/privacy}","received_events_url":"https://api.github.com/users/stgraber/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":12,"deletions":5,"changed_files":3}}
{"actor":{"display_login":"stgraber"}}