{"action":"created","comment":{"url":"https://api.github.com/repos/clearcontainers/runtime/pulls/comments/118748983","pull_request_review_id":40573880,"id":118748983,"diff_hunk":"@@ -0,0 +1,136 @@\n+// Copyright (c) 2014,2015,2016 Docker, Inc.\n+// Copyright (c) 2017 Intel Corporation\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//      http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"os\"\n+\t\"unsafe\"\n+\n+\t\"golang.org/x/sys/unix\"\n+)\n+\n+const ptmxPath = \"/dev/ptmx\"\n+\n+const ptsPtmxPath = \"/dev/pts/ptmx\"\n+\n+// Console represents a pseudo TTY.\n+type Console struct {\n+\tio.ReadWriteCloser\n+\n+\tmaster    *os.File\n+\tslavePath string\n+}\n+\n+// ConsoleFromFile creates a console from a file\n+func ConsoleFromFile(f *os.File) *Console {\n+\treturn &Console{\n+\t\tmaster: f,\n+\t}\n+}\n+\n+// NewConsole returns an initialized console that can be used within a container by copying bytes\n+// from the master side to the slave that is attached as the tty for the container's init process.\n+func newConsole() (*Console, error) {\n+\tmaster, err := os.OpenFile(ptmxPath, unix.O_RDWR|unix.O_NOCTTY|unix.O_CLOEXEC, 0)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tif err := saneTerminal(master); err != nil {\n+\t\treturn nil, err\n+\t}\n+\tconsole, err := ptsname(master)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tif err := unlockpt(master); err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn &Console{\n+\t\tslavePath: console,\n+\t\tmaster:    master,\n+\t}, nil\n+}\n+\n+func (c *Console) File() *os.File {\n+\treturn c.master\n+}\n+\n+func (c *Console) Path() string {\n+\treturn c.slavePath\n+}\n+\n+func (c *Console) Read(b []byte) (int, error) {\n+\treturn c.master.Read(b)\n+}\n+\n+func (c *Console) Write(b []byte) (int, error) {\n+\treturn c.master.Write(b)\n+}\n+\n+func (c *Console) Close() error {","path":"console.go","position":85,"original_position":85,"commit_id":"8956557010dc5e87a95ff7799030f30ce0c5898e","original_commit_id":"8956557010dc5e87a95ff7799030f30ce0c5898e","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars3.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"exported method Console.Close should have comment or be unexported","created_at":"2017-05-26T17:14:40Z","updated_at":"2017-05-26T17:14:40Z","html_url":"https://github.com/clearcontainers/runtime/pull/169#discussion_r118748983","pull_request_url":"https://api.github.com/repos/clearcontainers/runtime/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/comments/118748983"},"html":{"href":"https://github.com/clearcontainers/runtime/pull/169#discussion_r118748983"},"pull_request":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/clearcontainers/runtime/pulls/169","id":122292326,"html_url":"https://github.com/clearcontainers/runtime/pull/169","diff_url":"https://github.com/clearcontainers/runtime/pull/169.diff","patch_url":"https://github.com/clearcontainers/runtime/pull/169.patch","issue_url":"https://api.github.com/repos/clearcontainers/runtime/issues/169","number":169,"state":"open","locked":false,"title":"run: fix runtime standalone","user":{"login":"devimc","id":13009432,"avatar_url":"https://avatars3.githubusercontent.com/u/13009432?v=3","gravatar_id":"","url":"https://api.github.com/users/devimc","html_url":"https://github.com/devimc","followers_url":"https://api.github.com/users/devimc/followers","following_url":"https://api.github.com/users/devimc/following{/other_user}","gists_url":"https://api.github.com/users/devimc/gists{/gist_id}","starred_url":"https://api.github.com/users/devimc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devimc/subscriptions","organizations_url":"https://api.github.com/users/devimc/orgs","repos_url":"https://api.github.com/users/devimc/repos","events_url":"https://api.github.com/users/devimc/events{/privacy}","received_events_url":"https://api.github.com/users/devimc/received_events","type":"User","site_admin":false},"body":"With this patch a new pts will be created when the console provided as argument\r\nis /dev/ptmx or /dev/pts/ptmx.\r\n\r\nRuntime stdout and stdin will be forwarded to the master fd and then to the\r\nslave, something like this:\r\n\r\n```\r\n/dev/pts/0 <--> master <--> /dev/pts/1\r\n```\r\n\r\nwhere pts 0 is assigned to the runtime and pts 1 is assigned to the container.\r\n\r\nfixes #181\r\n\r\nSigned-off-by: Julio Montes <julio.montes@intel.com>","created_at":"2017-05-24T18:20:38Z","updated_at":"2017-05-26T17:14:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4301b80f43ddbce83f7c8ac26a903b7f4340452d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/clearcontainers/runtime/pulls/169/commits","review_comments_url":"https://api.github.com/repos/clearcontainers/runtime/pulls/169/comments","review_comment_url":"https://api.github.com/repos/clearcontainers/runtime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clearcontainers/runtime/issues/169/comments","statuses_url":"https://api.github.com/repos/clearcontainers/runtime/statuses/8956557010dc5e87a95ff7799030f30ce0c5898e","head":{"label":"devimc:topic/runAllocatePts","ref":"topic/runAllocatePts","sha":"8956557010dc5e87a95ff7799030f30ce0c5898e","user":{"login":"devimc","id":13009432,"avatar_url":"https://avatars3.githubusercontent.com/u/13009432?v=3","gravatar_id":"","url":"https://api.github.com/users/devimc","html_url":"https://github.com/devimc","followers_url":"https://api.github.com/users/devimc/followers","following_url":"https://api.github.com/users/devimc/following{/other_user}","gists_url":"https://api.github.com/users/devimc/gists{/gist_id}","starred_url":"https://api.github.com/users/devimc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devimc/subscriptions","organizations_url":"https://api.github.com/users/devimc/orgs","repos_url":"https://api.github.com/users/devimc/repos","events_url":"https://api.github.com/users/devimc/events{/privacy}","received_events_url":"https://api.github.com/users/devimc/received_events","type":"User","site_admin":false},"repo":{"id":80747568,"name":"runtime","full_name":"devimc/runtime","owner":{"login":"devimc","id":13009432,"avatar_url":"https://avatars3.githubusercontent.com/u/13009432?v=3","gravatar_id":"","url":"https://api.github.com/users/devimc","html_url":"https://github.com/devimc","followers_url":"https://api.github.com/users/devimc/followers","following_url":"https://api.github.com/users/devimc/following{/other_user}","gists_url":"https://api.github.com/users/devimc/gists{/gist_id}","starred_url":"https://api.github.com/users/devimc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devimc/subscriptions","organizations_url":"https://api.github.com/users/devimc/orgs","repos_url":"https://api.github.com/users/devimc/repos","events_url":"https://api.github.com/users/devimc/events{/privacy}","received_events_url":"https://api.github.com/users/devimc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/devimc/runtime","description":"OCI (Open Containers Initiative) compatible runtime ","fork":true,"url":"https://api.github.com/repos/devimc/runtime","forks_url":"https://api.github.com/repos/devimc/runtime/forks","keys_url":"https://api.github.com/repos/devimc/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devimc/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devimc/runtime/teams","hooks_url":"https://api.github.com/repos/devimc/runtime/hooks","issue_events_url":"https://api.github.com/repos/devimc/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/devimc/runtime/events","assignees_url":"https://api.github.com/repos/devimc/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/devimc/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/devimc/runtime/tags","blobs_url":"https://api.github.com/repos/devimc/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devimc/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devimc/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/devimc/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devimc/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/devimc/runtime/languages","stargazers_url":"https://api.github.com/repos/devimc/runtime/stargazers","contributors_url":"https://api.github.com/repos/devimc/runtime/contributors","subscribers_url":"https://api.github.com/repos/devimc/runtime/subscribers","subscription_url":"https://api.github.com/repos/devimc/runtime/subscription","commits_url":"https://api.github.com/repos/devimc/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/devimc/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/devimc/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/devimc/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/devimc/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/devimc/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devimc/runtime/merges","archive_url":"https://api.github.com/repos/devimc/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devimc/runtime/downloads","issues_url":"https://api.github.com/repos/devimc/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/devimc/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/devimc/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/devimc/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devimc/runtime/labels{/name}","releases_url":"https://api.github.com/repos/devimc/runtime/releases{/id}","deployments_url":"https://api.github.com/repos/devimc/runtime/deployments","created_at":"2017-02-02T17:07:01Z","updated_at":"2017-02-02T17:07:02Z","pushed_at":"2017-05-26T17:14:33Z","git_url":"git://github.com/devimc/runtime.git","ssh_url":"git@github.com:devimc/runtime.git","clone_url":"https://github.com/devimc/runtime.git","svn_url":"https://github.com/devimc/runtime","homepage":"","size":8026,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"clearcontainers:master","ref":"master","sha":"3391e03f497f2d1b717bfa26c7f3917fbc71345d","user":{"login":"clearcontainers","id":24325390,"avatar_url":"https://avatars2.githubusercontent.com/u/24325390?v=3","gravatar_id":"","url":"https://api.github.com/users/clearcontainers","html_url":"https://github.com/clearcontainers","followers_url":"https://api.github.com/users/clearcontainers/followers","following_url":"https://api.github.com/users/clearcontainers/following{/other_user}","gists_url":"https://api.github.com/users/clearcontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/clearcontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearcontainers/subscriptions","organizations_url":"https://api.github.com/users/clearcontainers/orgs","repos_url":"https://api.github.com/users/clearcontainers/repos","events_url":"https://api.github.com/users/clearcontainers/events{/privacy}","received_events_url":"https://api.github.com/users/clearcontainers/received_events","type":"Organization","site_admin":false},"repo":{"id":79110123,"name":"runtime","full_name":"clearcontainers/runtime","owner":{"login":"clearcontainers","id":24325390,"avatar_url":"https://avatars2.githubusercontent.com/u/24325390?v=3","gravatar_id":"","url":"https://api.github.com/users/clearcontainers","html_url":"https://github.com/clearcontainers","followers_url":"https://api.github.com/users/clearcontainers/followers","following_url":"https://api.github.com/users/clearcontainers/following{/other_user}","gists_url":"https://api.github.com/users/clearcontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/clearcontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearcontainers/subscriptions","organizations_url":"https://api.github.com/users/clearcontainers/orgs","repos_url":"https://api.github.com/users/clearcontainers/repos","events_url":"https://api.github.com/users/clearcontainers/events{/privacy}","received_events_url":"https://api.github.com/users/clearcontainers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clearcontainers/runtime","description":"OCI (Open Containers Initiative) compatible runtime ","fork":false,"url":"https://api.github.com/repos/clearcontainers/runtime","forks_url":"https://api.github.com/repos/clearcontainers/runtime/forks","keys_url":"https://api.github.com/repos/clearcontainers/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearcontainers/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearcontainers/runtime/teams","hooks_url":"https://api.github.com/repos/clearcontainers/runtime/hooks","issue_events_url":"https://api.github.com/repos/clearcontainers/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/clearcontainers/runtime/events","assignees_url":"https://api.github.com/repos/clearcontainers/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/clearcontainers/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/clearcontainers/runtime/tags","blobs_url":"https://api.github.com/repos/clearcontainers/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearcontainers/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearcontainers/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearcontainers/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearcontainers/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/clearcontainers/runtime/languages","stargazers_url":"https://api.github.com/repos/clearcontainers/runtime/stargazers","contributors_url":"https://api.github.com/repos/clearcontainers/runtime/contributors","subscribers_url":"https://api.github.com/repos/clearcontainers/runtime/subscribers","subscription_url":"https://api.github.com/repos/clearcontainers/runtime/subscription","commits_url":"https://api.github.com/repos/clearcontainers/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearcontainers/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearcontainers/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearcontainers/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearcontainers/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/clearcontainers/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearcontainers/runtime/merges","archive_url":"https://api.github.com/repos/clearcontainers/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearcontainers/runtime/downloads","issues_url":"https://api.github.com/repos/clearcontainers/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/clearcontainers/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/clearcontainers/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/clearcontainers/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearcontainers/runtime/labels{/name}","releases_url":"https://api.github.com/repos/clearcontainers/runtime/releases{/id}","deployments_url":"https://api.github.com/repos/clearcontainers/runtime/deployments","created_at":"2017-01-16T11:00:58Z","updated_at":"2017-05-11T13:46:28Z","pushed_at":"2017-05-26T17:14:35Z","git_url":"git://github.com/clearcontainers/runtime.git","ssh_url":"git@github.com:clearcontainers/runtime.git","clone_url":"https://github.com/clearcontainers/runtime.git","svn_url":"https://github.com/clearcontainers/runtime","homepage":"","size":8022,"stargazers_count":7,"watchers_count":7,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":79,"forks":6,"open_issues":79,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/169"},"html":{"href":"https://github.com/clearcontainers/runtime/pull/169"},"issue":{"href":"https://api.github.com/repos/clearcontainers/runtime/issues/169"},"comments":{"href":"https://api.github.com/repos/clearcontainers/runtime/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clearcontainers/runtime/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/clearcontainers/runtime/statuses/8956557010dc5e87a95ff7799030f30ce0c5898e"}}}}
{"actor":{"display_login":"houndci-bot"}}