{"action":"created","comment":{"url":"https://api.github.com/repos/steelbrain/exec/pulls/comments/61942762","id":61942762,"diff_hunk":"@@ -36,18 +36,28 @@ async function exec(\n     spawnedProcess.on('error', function(error) {\n       reject(error)\n     })\n-    spawnedProcess.on('close', function() {\n+    spawnedProcess.on('close', function(exitCode) {\n       clearTimeout(timeout)\n       if (options.stream === 'stdout') {\n         if (data.stderr.length && options.throwOnStdErr) {\n           reject(new Error(data.stderr.join('').trim()))\n         } else {\n-          resolve(data.stdout.join('').trim())\n+          const stdout = data.stdout.join('').trim()\n+          if (exitCode !== 0) {\n+            reject(new Error(`Process exited with non-zero code: ${exitCode}`))","path":"src/index.js","position":14,"original_position":14,"commit_id":"a3820aa5311a0faca6f255cb9492f5a3c6bfd2cb","original_commit_id":"6aaed0a9c3ad8cd102fdf098dc1e626b64a12547","user":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"body":"I think we could `console.error` it","created_at":"2016-05-03T19:41:47Z","updated_at":"2016-05-03T19:41:47Z","html_url":"https://github.com/steelbrain/exec/pull/15#discussion_r61942762","pull_request_url":"https://api.github.com/repos/steelbrain/exec/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/comments/61942762"},"html":{"href":"https://github.com/steelbrain/exec/pull/15#discussion_r61942762"},"pull_request":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/steelbrain/exec/pulls/15","id":68757476,"html_url":"https://github.com/steelbrain/exec/pull/15","diff_url":"https://github.com/steelbrain/exec/pull/15.diff","patch_url":"https://github.com/steelbrain/exec/pull/15.patch","issue_url":"https://api.github.com/repos/steelbrain/exec/issues/15","number":15,"state":"open","locked":false,"title":"Properly handle exit codes","user":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"body":"Fixes #14\r\n\r\n#### Todo\r\n\r\n- [x] Add a few specs","created_at":"2016-05-03T19:02:42Z","updated_at":"2016-05-03T19:41:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7bdcc8c93b8e7dbc8c1debb770aa15e444333375","assignee":{"login":"Arcanemagus","id":427137,"avatar_url":"https://avatars.githubusercontent.com/u/427137?v=3","gravatar_id":"","url":"https://api.github.com/users/Arcanemagus","html_url":"https://github.com/Arcanemagus","followers_url":"https://api.github.com/users/Arcanemagus/followers","following_url":"https://api.github.com/users/Arcanemagus/following{/other_user}","gists_url":"https://api.github.com/users/Arcanemagus/gists{/gist_id}","starred_url":"https://api.github.com/users/Arcanemagus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arcanemagus/subscriptions","organizations_url":"https://api.github.com/users/Arcanemagus/orgs","repos_url":"https://api.github.com/users/Arcanemagus/repos","events_url":"https://api.github.com/users/Arcanemagus/events{/privacy}","received_events_url":"https://api.github.com/users/Arcanemagus/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/steelbrain/exec/pulls/15/commits","review_comments_url":"https://api.github.com/repos/steelbrain/exec/pulls/15/comments","review_comment_url":"https://api.github.com/repos/steelbrain/exec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/steelbrain/exec/issues/15/comments","statuses_url":"https://api.github.com/repos/steelbrain/exec/statuses/a3820aa5311a0faca6f255cb9492f5a3c6bfd2cb","head":{"label":"steelbrain:steelbrain/work-with-exit-codes","ref":"steelbrain/work-with-exit-codes","sha":"a3820aa5311a0faca6f255cb9492f5a3c6bfd2cb","user":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"repo":{"id":52685302,"name":"exec","full_name":"steelbrain/exec","owner":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steelbrain/exec","description":"Node's Process spawning APIs beautified","fork":false,"url":"https://api.github.com/repos/steelbrain/exec","forks_url":"https://api.github.com/repos/steelbrain/exec/forks","keys_url":"https://api.github.com/repos/steelbrain/exec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steelbrain/exec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steelbrain/exec/teams","hooks_url":"https://api.github.com/repos/steelbrain/exec/hooks","issue_events_url":"https://api.github.com/repos/steelbrain/exec/issues/events{/number}","events_url":"https://api.github.com/repos/steelbrain/exec/events","assignees_url":"https://api.github.com/repos/steelbrain/exec/assignees{/user}","branches_url":"https://api.github.com/repos/steelbrain/exec/branches{/branch}","tags_url":"https://api.github.com/repos/steelbrain/exec/tags","blobs_url":"https://api.github.com/repos/steelbrain/exec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steelbrain/exec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steelbrain/exec/git/refs{/sha}","trees_url":"https://api.github.com/repos/steelbrain/exec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steelbrain/exec/statuses/{sha}","languages_url":"https://api.github.com/repos/steelbrain/exec/languages","stargazers_url":"https://api.github.com/repos/steelbrain/exec/stargazers","contributors_url":"https://api.github.com/repos/steelbrain/exec/contributors","subscribers_url":"https://api.github.com/repos/steelbrain/exec/subscribers","subscription_url":"https://api.github.com/repos/steelbrain/exec/subscription","commits_url":"https://api.github.com/repos/steelbrain/exec/commits{/sha}","git_commits_url":"https://api.github.com/repos/steelbrain/exec/git/commits{/sha}","comments_url":"https://api.github.com/repos/steelbrain/exec/comments{/number}","issue_comment_url":"https://api.github.com/repos/steelbrain/exec/issues/comments{/number}","contents_url":"https://api.github.com/repos/steelbrain/exec/contents/{+path}","compare_url":"https://api.github.com/repos/steelbrain/exec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steelbrain/exec/merges","archive_url":"https://api.github.com/repos/steelbrain/exec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steelbrain/exec/downloads","issues_url":"https://api.github.com/repos/steelbrain/exec/issues{/number}","pulls_url":"https://api.github.com/repos/steelbrain/exec/pulls{/number}","milestones_url":"https://api.github.com/repos/steelbrain/exec/milestones{/number}","notifications_url":"https://api.github.com/repos/steelbrain/exec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steelbrain/exec/labels{/name}","releases_url":"https://api.github.com/repos/steelbrain/exec/releases{/id}","deployments_url":"https://api.github.com/repos/steelbrain/exec/deployments","created_at":"2016-02-27T19:42:34Z","updated_at":"2016-03-31T15:06:32Z","pushed_at":"2016-05-03T19:40:12Z","git_url":"git://github.com/steelbrain/exec.git","ssh_url":"git@github.com:steelbrain/exec.git","clone_url":"https://github.com/steelbrain/exec.git","svn_url":"https://github.com/steelbrain/exec","homepage":null,"size":55,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"steelbrain:master","ref":"master","sha":"87777313d3114056384d9292b4fa267b57739a77","user":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"repo":{"id":52685302,"name":"exec","full_name":"steelbrain/exec","owner":{"login":"steelbrain","id":4278113,"avatar_url":"https://avatars.githubusercontent.com/u/4278113?v=3","gravatar_id":"","url":"https://api.github.com/users/steelbrain","html_url":"https://github.com/steelbrain","followers_url":"https://api.github.com/users/steelbrain/followers","following_url":"https://api.github.com/users/steelbrain/following{/other_user}","gists_url":"https://api.github.com/users/steelbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/steelbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steelbrain/subscriptions","organizations_url":"https://api.github.com/users/steelbrain/orgs","repos_url":"https://api.github.com/users/steelbrain/repos","events_url":"https://api.github.com/users/steelbrain/events{/privacy}","received_events_url":"https://api.github.com/users/steelbrain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steelbrain/exec","description":"Node's Process spawning APIs beautified","fork":false,"url":"https://api.github.com/repos/steelbrain/exec","forks_url":"https://api.github.com/repos/steelbrain/exec/forks","keys_url":"https://api.github.com/repos/steelbrain/exec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steelbrain/exec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steelbrain/exec/teams","hooks_url":"https://api.github.com/repos/steelbrain/exec/hooks","issue_events_url":"https://api.github.com/repos/steelbrain/exec/issues/events{/number}","events_url":"https://api.github.com/repos/steelbrain/exec/events","assignees_url":"https://api.github.com/repos/steelbrain/exec/assignees{/user}","branches_url":"https://api.github.com/repos/steelbrain/exec/branches{/branch}","tags_url":"https://api.github.com/repos/steelbrain/exec/tags","blobs_url":"https://api.github.com/repos/steelbrain/exec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steelbrain/exec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steelbrain/exec/git/refs{/sha}","trees_url":"https://api.github.com/repos/steelbrain/exec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steelbrain/exec/statuses/{sha}","languages_url":"https://api.github.com/repos/steelbrain/exec/languages","stargazers_url":"https://api.github.com/repos/steelbrain/exec/stargazers","contributors_url":"https://api.github.com/repos/steelbrain/exec/contributors","subscribers_url":"https://api.github.com/repos/steelbrain/exec/subscribers","subscription_url":"https://api.github.com/repos/steelbrain/exec/subscription","commits_url":"https://api.github.com/repos/steelbrain/exec/commits{/sha}","git_commits_url":"https://api.github.com/repos/steelbrain/exec/git/commits{/sha}","comments_url":"https://api.github.com/repos/steelbrain/exec/comments{/number}","issue_comment_url":"https://api.github.com/repos/steelbrain/exec/issues/comments{/number}","contents_url":"https://api.github.com/repos/steelbrain/exec/contents/{+path}","compare_url":"https://api.github.com/repos/steelbrain/exec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steelbrain/exec/merges","archive_url":"https://api.github.com/repos/steelbrain/exec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steelbrain/exec/downloads","issues_url":"https://api.github.com/repos/steelbrain/exec/issues{/number}","pulls_url":"https://api.github.com/repos/steelbrain/exec/pulls{/number}","milestones_url":"https://api.github.com/repos/steelbrain/exec/milestones{/number}","notifications_url":"https://api.github.com/repos/steelbrain/exec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steelbrain/exec/labels{/name}","releases_url":"https://api.github.com/repos/steelbrain/exec/releases{/id}","deployments_url":"https://api.github.com/repos/steelbrain/exec/deployments","created_at":"2016-02-27T19:42:34Z","updated_at":"2016-03-31T15:06:32Z","pushed_at":"2016-05-03T19:40:12Z","git_url":"git://github.com/steelbrain/exec.git","ssh_url":"git@github.com:steelbrain/exec.git","clone_url":"https://github.com/steelbrain/exec.git","svn_url":"https://github.com/steelbrain/exec","homepage":null,"size":55,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/15"},"html":{"href":"https://github.com/steelbrain/exec/pull/15"},"issue":{"href":"https://api.github.com/repos/steelbrain/exec/issues/15"},"comments":{"href":"https://api.github.com/repos/steelbrain/exec/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/steelbrain/exec/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/steelbrain/exec/statuses/a3820aa5311a0faca6f255cb9492f5a3c6bfd2cb"}}}}