{"action":"created","comment":{"url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/comments/119731779","pull_request_review_id":41640492,"id":119731779,"diff_hunk":"@@ -775,15 +775,111 @@ void hyper_shutdown()\n \treboot(LINUX_REBOOT_CMD_POWER_OFF);\n }\n \n-int hyper_cmd(char *cmd)\n+/**\n+ * Reads command stdout\n+ *\n+ * \\param stdout_pipe command stdout fd\n+ * \\param[out] output command stdout\n+ * \\param[out] size command stdout size, if is NULL then it is not used\n+ *\n+ * \\return 0 on success, else -1\n+ */\n+static int hyper_read_cmd_stdout(int stdout_pipe, uint8_t **output, size_t *size)\n+{\n+\tsize_t total_bytes_read = 0;\n+\tint bytes_read = 0;\n+\tsize_t bufsize = 512;\n+\tuint8_t *buffer = NULL;\n+\n+\tif (stdout_pipe < 0 || output == NULL) {\n+\t\treturn -1;\n+\t}\n+\n+\tbuffer = calloc(bufsize, sizeof(*buffer));\n+\n+\tif (buffer == NULL) {\n+\t\t/* try once again */\n+\t\tbuffer = calloc(bufsize, sizeof(*buffer));\n+\t}\n+\n+\tif (buffer == NULL) {\n+\t\treturn -1;\n+\t}\n+\n+\tdo {\n+\t\tbytes_read = read(stdout_pipe,\n+\t\t\tbuffer+total_bytes_read, bufsize-total_bytes_read);\n+\n+\t\tif (bytes_read < 0) {\n+\t\t\t/* there is no more data */\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (bytes_read > 0) {\n+\t\t\ttotal_bytes_read += bytes_read;\n+\t\t\tbuffer[total_bytes_read] = '\\0';","path":"src/util.c","position":56,"original_position":56,"commit_id":"ea192fb68e7f33652e29c027f05f3830577d2344","original_commit_id":"1dff70834c5afc8e64b2c17614a3532780a3e92d","user":{"login":"amshinde","id":7132811,"avatar_url":"https://avatars3.githubusercontent.com/u/7132811?v=3","gravatar_id":"","url":"https://api.github.com/users/amshinde","html_url":"https://github.com/amshinde","followers_url":"https://api.github.com/users/amshinde/followers","following_url":"https://api.github.com/users/amshinde/following{/other_user}","gists_url":"https://api.github.com/users/amshinde/gists{/gist_id}","starred_url":"https://api.github.com/users/amshinde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amshinde/subscriptions","organizations_url":"https://api.github.com/users/amshinde/orgs","repos_url":"https://api.github.com/users/amshinde/repos","events_url":"https://api.github.com/users/amshinde/events{/privacy}","received_events_url":"https://api.github.com/users/amshinde/received_events","type":"User","site_admin":false},"body":"This assignment can be moved out of the loop I think to perform it just once","created_at":"2017-06-01T21:19:48Z","updated_at":"2017-06-01T21:19:48Z","html_url":"https://github.com/clearcontainers/hyperstart/pull/30#discussion_r119731779","pull_request_url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/comments/119731779"},"html":{"href":"https://github.com/clearcontainers/hyperstart/pull/30#discussion_r119731779"},"pull_request":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30","id":122094262,"html_url":"https://github.com/clearcontainers/hyperstart/pull/30","diff_url":"https://github.com/clearcontainers/hyperstart/pull/30.diff","patch_url":"https://github.com/clearcontainers/hyperstart/pull/30.patch","issue_url":"https://api.github.com/repos/clearcontainers/hyperstart/issues/30","number":30,"state":"open","locked":false,"title":"ps: ps command implementation","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":"this patch adds the implementation for ps command, ps output will\r\nbe parsed to see what processes are running inside the given\r\ncontainer therefore a list of processes that belong to the container\r\nis returned\r\n\r\nSigned-off-by: Julio Montes <julio.montes@intel.com>","created_at":"2017-05-23T21:00:03Z","updated_at":"2017-06-01T21:19:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"522aded7be72908ce00735b45ebb51de25939032","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30/commits","review_comments_url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30/comments","review_comment_url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clearcontainers/hyperstart/issues/30/comments","statuses_url":"https://api.github.com/repos/clearcontainers/hyperstart/statuses/ea192fb68e7f33652e29c027f05f3830577d2344","head":{"label":"devimc:topic/psCommand","ref":"topic/psCommand","sha":"ea192fb68e7f33652e29c027f05f3830577d2344","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":69053239,"name":"hyperstart","full_name":"devimc/hyperstart","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/hyperstart","description":"The tiny Init service for HyperContainer","fork":true,"url":"https://api.github.com/repos/devimc/hyperstart","forks_url":"https://api.github.com/repos/devimc/hyperstart/forks","keys_url":"https://api.github.com/repos/devimc/hyperstart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devimc/hyperstart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devimc/hyperstart/teams","hooks_url":"https://api.github.com/repos/devimc/hyperstart/hooks","issue_events_url":"https://api.github.com/repos/devimc/hyperstart/issues/events{/number}","events_url":"https://api.github.com/repos/devimc/hyperstart/events","assignees_url":"https://api.github.com/repos/devimc/hyperstart/assignees{/user}","branches_url":"https://api.github.com/repos/devimc/hyperstart/branches{/branch}","tags_url":"https://api.github.com/repos/devimc/hyperstart/tags","blobs_url":"https://api.github.com/repos/devimc/hyperstart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devimc/hyperstart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devimc/hyperstart/git/refs{/sha}","trees_url":"https://api.github.com/repos/devimc/hyperstart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devimc/hyperstart/statuses/{sha}","languages_url":"https://api.github.com/repos/devimc/hyperstart/languages","stargazers_url":"https://api.github.com/repos/devimc/hyperstart/stargazers","contributors_url":"https://api.github.com/repos/devimc/hyperstart/contributors","subscribers_url":"https://api.github.com/repos/devimc/hyperstart/subscribers","subscription_url":"https://api.github.com/repos/devimc/hyperstart/subscription","commits_url":"https://api.github.com/repos/devimc/hyperstart/commits{/sha}","git_commits_url":"https://api.github.com/repos/devimc/hyperstart/git/commits{/sha}","comments_url":"https://api.github.com/repos/devimc/hyperstart/comments{/number}","issue_comment_url":"https://api.github.com/repos/devimc/hyperstart/issues/comments{/number}","contents_url":"https://api.github.com/repos/devimc/hyperstart/contents/{+path}","compare_url":"https://api.github.com/repos/devimc/hyperstart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devimc/hyperstart/merges","archive_url":"https://api.github.com/repos/devimc/hyperstart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devimc/hyperstart/downloads","issues_url":"https://api.github.com/repos/devimc/hyperstart/issues{/number}","pulls_url":"https://api.github.com/repos/devimc/hyperstart/pulls{/number}","milestones_url":"https://api.github.com/repos/devimc/hyperstart/milestones{/number}","notifications_url":"https://api.github.com/repos/devimc/hyperstart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devimc/hyperstart/labels{/name}","releases_url":"https://api.github.com/repos/devimc/hyperstart/releases{/id}","deployments_url":"https://api.github.com/repos/devimc/hyperstart/deployments","created_at":"2016-09-23T19:05:51Z","updated_at":"2016-09-23T19:05:53Z","pushed_at":"2017-05-31T16:07:49Z","git_url":"git://github.com/devimc/hyperstart.git","ssh_url":"git@github.com:devimc/hyperstart.git","clone_url":"https://github.com/devimc/hyperstart.git","svn_url":"https://github.com/devimc/hyperstart","homepage":"https://www.hypercontainer.io","size":55101,"stargazers_count":0,"watchers_count":0,"language":"C","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:0.7.0-clearcontainers","ref":"0.7.0-clearcontainers","sha":"f12ce98d7e8b3052b351288aae7e88a611960160","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":78546527,"name":"hyperstart","full_name":"clearcontainers/hyperstart","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/hyperstart","description":"The tiny Init service for HyperContainer","fork":true,"url":"https://api.github.com/repos/clearcontainers/hyperstart","forks_url":"https://api.github.com/repos/clearcontainers/hyperstart/forks","keys_url":"https://api.github.com/repos/clearcontainers/hyperstart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearcontainers/hyperstart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearcontainers/hyperstart/teams","hooks_url":"https://api.github.com/repos/clearcontainers/hyperstart/hooks","issue_events_url":"https://api.github.com/repos/clearcontainers/hyperstart/issues/events{/number}","events_url":"https://api.github.com/repos/clearcontainers/hyperstart/events","assignees_url":"https://api.github.com/repos/clearcontainers/hyperstart/assignees{/user}","branches_url":"https://api.github.com/repos/clearcontainers/hyperstart/branches{/branch}","tags_url":"https://api.github.com/repos/clearcontainers/hyperstart/tags","blobs_url":"https://api.github.com/repos/clearcontainers/hyperstart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearcontainers/hyperstart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearcontainers/hyperstart/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearcontainers/hyperstart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearcontainers/hyperstart/statuses/{sha}","languages_url":"https://api.github.com/repos/clearcontainers/hyperstart/languages","stargazers_url":"https://api.github.com/repos/clearcontainers/hyperstart/stargazers","contributors_url":"https://api.github.com/repos/clearcontainers/hyperstart/contributors","subscribers_url":"https://api.github.com/repos/clearcontainers/hyperstart/subscribers","subscription_url":"https://api.github.com/repos/clearcontainers/hyperstart/subscription","commits_url":"https://api.github.com/repos/clearcontainers/hyperstart/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearcontainers/hyperstart/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearcontainers/hyperstart/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearcontainers/hyperstart/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearcontainers/hyperstart/contents/{+path}","compare_url":"https://api.github.com/repos/clearcontainers/hyperstart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearcontainers/hyperstart/merges","archive_url":"https://api.github.com/repos/clearcontainers/hyperstart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearcontainers/hyperstart/downloads","issues_url":"https://api.github.com/repos/clearcontainers/hyperstart/issues{/number}","pulls_url":"https://api.github.com/repos/clearcontainers/hyperstart/pulls{/number}","milestones_url":"https://api.github.com/repos/clearcontainers/hyperstart/milestones{/number}","notifications_url":"https://api.github.com/repos/clearcontainers/hyperstart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearcontainers/hyperstart/labels{/name}","releases_url":"https://api.github.com/repos/clearcontainers/hyperstart/releases{/id}","deployments_url":"https://api.github.com/repos/clearcontainers/hyperstart/deployments","created_at":"2017-01-10T15:29:46Z","updated_at":"2017-04-28T14:16:25Z","pushed_at":"2017-06-01T20:09:27Z","git_url":"git://github.com/clearcontainers/hyperstart.git","ssh_url":"git@github.com:clearcontainers/hyperstart.git","clone_url":"https://github.com/clearcontainers/hyperstart.git","svn_url":"https://github.com/clearcontainers/hyperstart","homepage":"https://www.hypercontainer.io","size":55559,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":3,"default_branch":"0.7.0-clearcontainers"}},"_links":{"self":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30"},"html":{"href":"https://github.com/clearcontainers/hyperstart/pull/30"},"issue":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/issues/30"},"comments":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/clearcontainers/hyperstart/statuses/ea192fb68e7f33652e29c027f05f3830577d2344"}}}}
{"actor":{"display_login":"amshinde"}}