{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/37015007","id":37015007,"diff_hunk":"@@ -6,77 +6,63 @@ import (\n \t\"io\"\n \n \t\"github.com/Sirupsen/logrus\"\n-\t\"github.com/natefinch/npipe\"\n+\t\"github.com/docker/docker/daemon/execdriver\"\n )\n \n-// stdinAccept runs as a go function. It waits for the container system\n-// to accept our offer of a named pipe for stdin. Once accepted, if we are\n-// running \"attached\" to the container (eg docker run -i), then we spin up\n-// a further thread to copy anything from the client into the container.\n-//\n-// Important design note. This function is run as a go function for a very\n-// good reason. The named pipe Accept call is blocking until one of two things\n-// happen. Either someone connects to it, or it is forcibly closed. Let's\n-// assume that no-one connects to it, the only way otherwise the Run()\n-// method would continue is by closing it. However, as that would be the same\n-// thread, it can't close it. Hence we run as another thread allowing Run()\n-// to close the named pipe.\n-func stdinAccept(inListen *npipe.PipeListener, pipeName string, copyfrom io.ReadCloser) {\n+// General comment. Handling I/O for a container is very different to Linux.\n+// We use a named pipe to HCS to copy I/O both in and out of the container,\n+// very similar to how docker daemon communicates with a CLI.\n \n-\t// Wait for the pipe to be connected to by the shim\n-\tlogrus.Debugln(\"stdinAccept: Waiting on \", pipeName)\n-\tstdinConn, err := inListen.Accept()\n-\tif err != nil {\n-\t\tlogrus.Errorf(\"Failed to accept on pipe %s %s\", pipeName, err)\n-\t\treturn\n-\t}\n-\tlogrus.Debugln(\"Connected to \", stdinConn.RemoteAddr())\n+// startStdinCopy asynchronously copies an io.Reader to the container's\n+// process's stdin pipe and closes the pipe when there is no more data to copy.\n+func startStdinCopy(pipe io.WriteCloser, copyfrom io.Reader) {\n \n \t// Anything that comes from the client stdin should be copied\n \t// across to the stdin named pipe of the container.\n \tif copyfrom != nil {","path":"daemon/execdriver/windows/namedpipes.go","position":39,"original_position":39,"commit_id":"34e171df56bce314c0f83cce8e8ca3a3ec7928d0","original_commit_id":"34e171df56bce314c0f83cce8e8ca3a3ec7928d0","user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"body":"No need to be so defensive here: a nill `copyfrom` should be considered a programming error.\r\n\r\nThis function should return an error.","created_at":"2015-08-13T19:25:32Z","updated_at":"2015-08-13T19:25:32Z","html_url":"https://github.com/docker/docker/pull/14758#discussion_r37015007","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/14758","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/37015007"},"html":{"href":"https://github.com/docker/docker/pull/14758#discussion_r37015007"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/14758"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/14758","id":40369210,"html_url":"https://github.com/docker/docker/pull/14758","diff_url":"https://github.com/docker/docker/pull/14758.diff","patch_url":"https://github.com/docker/docker/pull/14758.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/14758","number":14758,"state":"open","locked":false,"title":"Windows: [TP3] new hcsshim stdin/out/err handling","user":{"login":"jhowardmsft","id":10522484,"avatar_url":"https://avatars.githubusercontent.com/u/10522484?v=3","gravatar_id":"","url":"https://api.github.com/users/jhowardmsft","html_url":"https://github.com/jhowardmsft","followers_url":"https://api.github.com/users/jhowardmsft/followers","following_url":"https://api.github.com/users/jhowardmsft/following{/other_user}","gists_url":"https://api.github.com/users/jhowardmsft/gists{/gist_id}","starred_url":"https://api.github.com/users/jhowardmsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhowardmsft/subscriptions","organizations_url":"https://api.github.com/users/jhowardmsft/orgs","repos_url":"https://api.github.com/users/jhowardmsft/repos","events_url":"https://api.github.com/users/jhowardmsft/events{/privacy}","received_events_url":"https://api.github.com/users/jhowardmsft/received_events","type":"User","site_admin":false},"body":"Signed-off-by: John Howard <jhoward@microsoft.com>\r\n\r\n@swernli @jstarks\r\n\r\nThis PR is part of the proposal described in docker/docker issue 10662 to port the docker daemon to Windows. This moves the named pipe handling into Windows.\r\n","created_at":"2015-07-20T16:13:23Z","updated_at":"2015-08-13T19:25:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"641cc22b4e034126d7b2e55780b332c125eae18f","assignee":{"login":"tiborvass","id":827131,"avatar_url":"https://avatars.githubusercontent.com/u/827131?v=3","gravatar_id":"","url":"https://api.github.com/users/tiborvass","html_url":"https://github.com/tiborvass","followers_url":"https://api.github.com/users/tiborvass/followers","following_url":"https://api.github.com/users/tiborvass/following{/other_user}","gists_url":"https://api.github.com/users/tiborvass/gists{/gist_id}","starred_url":"https://api.github.com/users/tiborvass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiborvass/subscriptions","organizations_url":"https://api.github.com/users/tiborvass/orgs","repos_url":"https://api.github.com/users/tiborvass/repos","events_url":"https://api.github.com/users/tiborvass/events{/privacy}","received_events_url":"https://api.github.com/users/tiborvass/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/14758/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/14758/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/14758/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/34e171df56bce314c0f83cce8e8ca3a3ec7928d0","head":{"label":"Microsoft:10662-pipestohcs","ref":"10662-pipestohcs","sha":"34e171df56bce314c0f83cce8e8ca3a3ec7928d0","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":30096470,"name":"docker","full_name":"Microsoft/docker","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/Microsoft/docker","forks_url":"https://api.github.com/repos/Microsoft/docker/forks","keys_url":"https://api.github.com/repos/Microsoft/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/docker/teams","hooks_url":"https://api.github.com/repos/Microsoft/docker/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/docker/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/docker/events","assignees_url":"https://api.github.com/repos/Microsoft/docker/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/docker/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/docker/tags","blobs_url":"https://api.github.com/repos/Microsoft/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/docker/languages","stargazers_url":"https://api.github.com/repos/Microsoft/docker/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/docker/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/docker/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/docker/subscription","commits_url":"https://api.github.com/repos/Microsoft/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/docker/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/docker/merges","archive_url":"https://api.github.com/repos/Microsoft/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/docker/downloads","issues_url":"https://api.github.com/repos/Microsoft/docker/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/docker/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/docker/releases{/id}","created_at":"2015-01-31T00:05:16Z","updated_at":"2015-08-10T18:27:58Z","pushed_at":"2015-08-13T18:34:40Z","git_url":"git://github.com/Microsoft/docker.git","ssh_url":"git@github.com:Microsoft/docker.git","clone_url":"https://github.com/Microsoft/docker.git","svn_url":"https://github.com/Microsoft/docker","homepage":"http://www.docker.com","size":68157,"stargazers_count":167,"watchers_count":167,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":0,"forks":30,"open_issues":0,"watchers":167,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"355f640d4d6c7f4cd4e3dafedd7f8eb5a8f2d0c5","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-08-13T18:45:51Z","pushed_at":"2015-08-13T18:50:36Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":239150,"stargazers_count":23988,"watchers_count":23988,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6094,"mirror_url":null,"open_issues_count":1090,"forks":6094,"open_issues":1090,"watchers":23988,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/14758"},"html":{"href":"https://github.com/docker/docker/pull/14758"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/14758"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/14758/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/14758/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/14758/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/34e171df56bce314c0f83cce8e8ca3a3ec7928d0"}}}}