{"action":"created","comment":{"url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/comments/110432011","pull_request_review_id":31608239,"id":110432011,"diff_hunk":"@@ -0,0 +1,89 @@\n+package common\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"os/exec\"\n+\t\"strings\"\n+\n+\tlog \"github.com/Sirupsen/logrus\"\n+)\n+\n+func CallPowershell(args ...string) (string, string, error) {\n+\tc := []string{\"-NonInteractive\"}\n+\tfor _, arg := range args {\n+\t\tc = append(c, arg)\n+\t}\n+\tcmd := exec.Command(\"powershell\", c...)\n+\n+\tlog.Debugf(\"Running Powershell command: %s. \", strings.Join(c[1:], \" \"))\n+\n+\tstdoutPipe, stderrPipe, err := setupOutputCollection(cmd)\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\n+\terr = cmd.Start()\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\n+\tstdout, stderr, err := collectOutput(stdoutPipe, stderrPipe)\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\n+\t// we drop the last two characters, because they are just newline\n+\tif len(stdout) > 2 {\n+\t\tstdout = stdout[:len(stdout)-2]\n+\t}\n+\n+\terr = cmd.Wait()\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\n+\tprintDebugInfo(c, stdout, stderr)\n+\n+\treturn stdout, stderr, nil\n+}\n+\n+func setupOutputCollection(cmd *exec.Cmd) (io.ReadCloser, io.ReadCloser, error) {\n+\tstdoutPipe, err := cmd.StdoutPipe()\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\tstderrPipe, err := cmd.StderrPipe()\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\treturn stdoutPipe, stderrPipe, err\n+}\n+\n+func collectOutput(stdoutPipe, stderrPipe io.ReadCloser) (string, string, error) {\n+\toutBuf, err := ioutil.ReadAll(stdoutPipe)\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\terrBuf, err := ioutil.ReadAll(stderrPipe)\n+\tif err != nil {\n+\t\treturn \"\", \"\", err\n+\t}\n+\n+\t// ReadAll returns in []byte, so convert to string\n+\treturn fmt.Sprintf(\"%s\", outBuf), fmt.Sprintf(\"%s\", errBuf), nil","path":"common/powershell.go","position":75,"original_position":75,"commit_id":"a729d2e6d0523deb3326bb9bcb1a5eb5b132381a","original_commit_id":"a729d2e6d0523deb3326bb9bcb1a5eb5b132381a","user":{"login":"m-kostrzewa","id":9220158,"avatar_url":"https://avatars0.githubusercontent.com/u/9220158?v=3","gravatar_id":"","url":"https://api.github.com/users/m-kostrzewa","html_url":"https://github.com/m-kostrzewa","followers_url":"https://api.github.com/users/m-kostrzewa/followers","following_url":"https://api.github.com/users/m-kostrzewa/following{/other_user}","gists_url":"https://api.github.com/users/m-kostrzewa/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kostrzewa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kostrzewa/subscriptions","organizations_url":"https://api.github.com/users/m-kostrzewa/orgs","repos_url":"https://api.github.com/users/m-kostrzewa/repos","events_url":"https://api.github.com/users/m-kostrzewa/events{/privacy}","received_events_url":"https://api.github.com/users/m-kostrzewa/received_events","type":"User","site_admin":false},"body":"I've spent like 2 hours on this, and it's not a critical issue right now. https://codilime.atlassian.net/browse/JW-356. Wip branch: https://github.com/codilime/contrail-windows-docker/tree/JW-356_powershell_encoding","created_at":"2017-04-07T16:41:56Z","updated_at":"2017-04-07T16:41:57Z","html_url":"https://github.com/codilime/contrail-windows-docker/pull/46#discussion_r110432011","pull_request_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/comments/110432011"},"html":{"href":"https://github.com/codilime/contrail-windows-docker/pull/46#discussion_r110432011"},"pull_request":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46","id":107647786,"html_url":"https://github.com/codilime/contrail-windows-docker/pull/46","diff_url":"https://github.com/codilime/contrail-windows-docker/pull/46.diff","patch_url":"https://github.com/codilime/contrail-windows-docker/pull/46.patch","issue_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/46","number":46,"state":"open","locked":false,"title":"JW-146 Enable hyper-v extension","user":{"login":"m-kostrzewa","id":9220158,"avatar_url":"https://avatars0.githubusercontent.com/u/9220158?v=3","gravatar_id":"","url":"https://api.github.com/users/m-kostrzewa","html_url":"https://github.com/m-kostrzewa","followers_url":"https://api.github.com/users/m-kostrzewa/followers","following_url":"https://api.github.com/users/m-kostrzewa/following{/other_user}","gists_url":"https://api.github.com/users/m-kostrzewa/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kostrzewa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kostrzewa/subscriptions","organizations_url":"https://api.github.com/users/m-kostrzewa/orgs","repos_url":"https://api.github.com/users/m-kostrzewa/repos","events_url":"https://api.github.com/users/m-kostrzewa/events{/privacy}","received_events_url":"https://api.github.com/users/m-kostrzewa/received_events","type":"User","site_admin":false},"body":"Enable Hyper-V extension when starting the driver.\r\n\r\nI had to improve powershell handling, and added a wrapper for dealing with hyper-v extension.","created_at":"2017-02-23T15:29:18Z","updated_at":"2017-04-07T16:41:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37a6b23f537527f0ba5492cd17331545d58223eb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46/commits","review_comments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46/comments","review_comment_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/46/comments","statuses_url":"https://api.github.com/repos/codilime/contrail-windows-docker/statuses/a729d2e6d0523deb3326bb9bcb1a5eb5b132381a","head":{"label":"codilime:JW-146_enable_extension","ref":"JW-146_enable_extension","sha":"a729d2e6d0523deb3326bb9bcb1a5eb5b132381a","user":{"login":"codilime","id":2143695,"avatar_url":"https://avatars2.githubusercontent.com/u/2143695?v=3","gravatar_id":"","url":"https://api.github.com/users/codilime","html_url":"https://github.com/codilime","followers_url":"https://api.github.com/users/codilime/followers","following_url":"https://api.github.com/users/codilime/following{/other_user}","gists_url":"https://api.github.com/users/codilime/gists{/gist_id}","starred_url":"https://api.github.com/users/codilime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codilime/subscriptions","organizations_url":"https://api.github.com/users/codilime/orgs","repos_url":"https://api.github.com/users/codilime/repos","events_url":"https://api.github.com/users/codilime/events{/privacy}","received_events_url":"https://api.github.com/users/codilime/received_events","type":"Organization","site_admin":false},"repo":{"id":75595436,"name":"contrail-windows-docker","full_name":"codilime/contrail-windows-docker","owner":{"login":"codilime","id":2143695,"avatar_url":"https://avatars2.githubusercontent.com/u/2143695?v=3","gravatar_id":"","url":"https://api.github.com/users/codilime","html_url":"https://github.com/codilime","followers_url":"https://api.github.com/users/codilime/followers","following_url":"https://api.github.com/users/codilime/following{/other_user}","gists_url":"https://api.github.com/users/codilime/gists{/gist_id}","starred_url":"https://api.github.com/users/codilime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codilime/subscriptions","organizations_url":"https://api.github.com/users/codilime/orgs","repos_url":"https://api.github.com/users/codilime/repos","events_url":"https://api.github.com/users/codilime/events{/privacy}","received_events_url":"https://api.github.com/users/codilime/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codilime/contrail-windows-docker","description":null,"fork":false,"url":"https://api.github.com/repos/codilime/contrail-windows-docker","forks_url":"https://api.github.com/repos/codilime/contrail-windows-docker/forks","keys_url":"https://api.github.com/repos/codilime/contrail-windows-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codilime/contrail-windows-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codilime/contrail-windows-docker/teams","hooks_url":"https://api.github.com/repos/codilime/contrail-windows-docker/hooks","issue_events_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/events{/number}","events_url":"https://api.github.com/repos/codilime/contrail-windows-docker/events","assignees_url":"https://api.github.com/repos/codilime/contrail-windows-docker/assignees{/user}","branches_url":"https://api.github.com/repos/codilime/contrail-windows-docker/branches{/branch}","tags_url":"https://api.github.com/repos/codilime/contrail-windows-docker/tags","blobs_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codilime/contrail-windows-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/codilime/contrail-windows-docker/languages","stargazers_url":"https://api.github.com/repos/codilime/contrail-windows-docker/stargazers","contributors_url":"https://api.github.com/repos/codilime/contrail-windows-docker/contributors","subscribers_url":"https://api.github.com/repos/codilime/contrail-windows-docker/subscribers","subscription_url":"https://api.github.com/repos/codilime/contrail-windows-docker/subscription","commits_url":"https://api.github.com/repos/codilime/contrail-windows-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/codilime/contrail-windows-docker/contents/{+path}","compare_url":"https://api.github.com/repos/codilime/contrail-windows-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codilime/contrail-windows-docker/merges","archive_url":"https://api.github.com/repos/codilime/contrail-windows-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codilime/contrail-windows-docker/downloads","issues_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues{/number}","pulls_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/codilime/contrail-windows-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/codilime/contrail-windows-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codilime/contrail-windows-docker/labels{/name}","releases_url":"https://api.github.com/repos/codilime/contrail-windows-docker/releases{/id}","deployments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/deployments","created_at":"2016-12-05T06:25:36Z","updated_at":"2016-12-06T12:40:13Z","pushed_at":"2017-04-07T16:41:18Z","git_url":"git://github.com/codilime/contrail-windows-docker.git","ssh_url":"git@github.com:codilime/contrail-windows-docker.git","clone_url":"https://github.com/codilime/contrail-windows-docker.git","svn_url":"https://github.com/codilime/contrail-windows-docker","homepage":null,"size":2856,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"codilime:master","ref":"master","sha":"42d84f841aba15aaad760d8bbcffc4c637710ed5","user":{"login":"codilime","id":2143695,"avatar_url":"https://avatars2.githubusercontent.com/u/2143695?v=3","gravatar_id":"","url":"https://api.github.com/users/codilime","html_url":"https://github.com/codilime","followers_url":"https://api.github.com/users/codilime/followers","following_url":"https://api.github.com/users/codilime/following{/other_user}","gists_url":"https://api.github.com/users/codilime/gists{/gist_id}","starred_url":"https://api.github.com/users/codilime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codilime/subscriptions","organizations_url":"https://api.github.com/users/codilime/orgs","repos_url":"https://api.github.com/users/codilime/repos","events_url":"https://api.github.com/users/codilime/events{/privacy}","received_events_url":"https://api.github.com/users/codilime/received_events","type":"Organization","site_admin":false},"repo":{"id":75595436,"name":"contrail-windows-docker","full_name":"codilime/contrail-windows-docker","owner":{"login":"codilime","id":2143695,"avatar_url":"https://avatars2.githubusercontent.com/u/2143695?v=3","gravatar_id":"","url":"https://api.github.com/users/codilime","html_url":"https://github.com/codilime","followers_url":"https://api.github.com/users/codilime/followers","following_url":"https://api.github.com/users/codilime/following{/other_user}","gists_url":"https://api.github.com/users/codilime/gists{/gist_id}","starred_url":"https://api.github.com/users/codilime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codilime/subscriptions","organizations_url":"https://api.github.com/users/codilime/orgs","repos_url":"https://api.github.com/users/codilime/repos","events_url":"https://api.github.com/users/codilime/events{/privacy}","received_events_url":"https://api.github.com/users/codilime/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codilime/contrail-windows-docker","description":null,"fork":false,"url":"https://api.github.com/repos/codilime/contrail-windows-docker","forks_url":"https://api.github.com/repos/codilime/contrail-windows-docker/forks","keys_url":"https://api.github.com/repos/codilime/contrail-windows-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codilime/contrail-windows-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codilime/contrail-windows-docker/teams","hooks_url":"https://api.github.com/repos/codilime/contrail-windows-docker/hooks","issue_events_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/events{/number}","events_url":"https://api.github.com/repos/codilime/contrail-windows-docker/events","assignees_url":"https://api.github.com/repos/codilime/contrail-windows-docker/assignees{/user}","branches_url":"https://api.github.com/repos/codilime/contrail-windows-docker/branches{/branch}","tags_url":"https://api.github.com/repos/codilime/contrail-windows-docker/tags","blobs_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codilime/contrail-windows-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/codilime/contrail-windows-docker/languages","stargazers_url":"https://api.github.com/repos/codilime/contrail-windows-docker/stargazers","contributors_url":"https://api.github.com/repos/codilime/contrail-windows-docker/contributors","subscribers_url":"https://api.github.com/repos/codilime/contrail-windows-docker/subscribers","subscription_url":"https://api.github.com/repos/codilime/contrail-windows-docker/subscription","commits_url":"https://api.github.com/repos/codilime/contrail-windows-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/codilime/contrail-windows-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/codilime/contrail-windows-docker/contents/{+path}","compare_url":"https://api.github.com/repos/codilime/contrail-windows-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codilime/contrail-windows-docker/merges","archive_url":"https://api.github.com/repos/codilime/contrail-windows-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codilime/contrail-windows-docker/downloads","issues_url":"https://api.github.com/repos/codilime/contrail-windows-docker/issues{/number}","pulls_url":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/codilime/contrail-windows-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/codilime/contrail-windows-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codilime/contrail-windows-docker/labels{/name}","releases_url":"https://api.github.com/repos/codilime/contrail-windows-docker/releases{/id}","deployments_url":"https://api.github.com/repos/codilime/contrail-windows-docker/deployments","created_at":"2016-12-05T06:25:36Z","updated_at":"2016-12-06T12:40:13Z","pushed_at":"2017-04-07T16:41:18Z","git_url":"git://github.com/codilime/contrail-windows-docker.git","ssh_url":"git@github.com:codilime/contrail-windows-docker.git","clone_url":"https://github.com/codilime/contrail-windows-docker.git","svn_url":"https://github.com/codilime/contrail-windows-docker","homepage":null,"size":2856,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46"},"html":{"href":"https://github.com/codilime/contrail-windows-docker/pull/46"},"issue":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/46"},"comments":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/codilime/contrail-windows-docker/statuses/a729d2e6d0523deb3326bb9bcb1a5eb5b132381a"}}}}
{"actor":{"display_login":"m-kostrzewa"}}