{"action":"created","issue":{"url":"https://api.github.com/repos/chriso/curlrequest/issues/26","labels_url":"https://api.github.com/repos/chriso/curlrequest/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/chriso/curlrequest/issues/26/comments","events_url":"https://api.github.com/repos/chriso/curlrequest/issues/26/events","html_url":"https://github.com/chriso/curlrequest/issues/26","id":97846678,"number":26,"title":"curl request call callback function before get all stdout stream.","user":{"login":"floodZero","id":1468787,"avatar_url":"https://avatars.githubusercontent.com/u/1468787?v=3","gravatar_id":"","url":"https://api.github.com/users/floodZero","html_url":"https://github.com/floodZero","followers_url":"https://api.github.com/users/floodZero/followers","following_url":"https://api.github.com/users/floodZero/following{/other_user}","gists_url":"https://api.github.com/users/floodZero/gists{/gist_id}","starred_url":"https://api.github.com/users/floodZero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floodZero/subscriptions","organizations_url":"https://api.github.com/users/floodZero/orgs","repos_url":"https://api.github.com/users/floodZero/repos","events_url":"https://api.github.com/users/floodZero/events{/privacy}","received_events_url":"https://api.github.com/users/floodZero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T02:50:44Z","updated_at":"2015-07-29T05:56:05Z","closed_at":null,"body":"Hi, chriso.\r\nI'm gavin of korea. (So, you could feel odd in my English.)\r\n\r\nI found some issue on rapid request situation.\r\nWhen curlrequest.request called rapidly, callback's data argument get \"\" string often.\r\nWith no error object and no stdrerr stream.\r\nAlso i checked packets, and it's good. there's no problem.\r\n\r\nAnd I solved this issue, I think.\r\n\r\nI changed bind of \"exit\" event to \"close\". And \"\" string output disappeared.\r\n\r\n```javascript\r\n//Handle curl exit\r\ncurl.on('exit', function (code) {\r\n  try {\r\n    err = code;\r\n\r\nto\r\n\r\ncurl.on('close', function (code) {\r\n  try {\r\n    err = code;\r\n```\r\n\r\nAccording to this [API doc](https://nodejs.org/api/child_process.html#child_process_event_exit), \r\n\"exit\" event can be emitted before stdout stream flushed.\r\n\r\nHow you think about this modification? "},"comment":{"url":"https://api.github.com/repos/chriso/curlrequest/issues/comments/125850840","html_url":"https://github.com/chriso/curlrequest/issues/26#issuecomment-125850840","issue_url":"https://api.github.com/repos/chriso/curlrequest/issues/26","id":125850840,"user":{"login":"floodZero","id":1468787,"avatar_url":"https://avatars.githubusercontent.com/u/1468787?v=3","gravatar_id":"","url":"https://api.github.com/users/floodZero","html_url":"https://github.com/floodZero","followers_url":"https://api.github.com/users/floodZero/followers","following_url":"https://api.github.com/users/floodZero/following{/other_user}","gists_url":"https://api.github.com/users/floodZero/gists{/gist_id}","starred_url":"https://api.github.com/users/floodZero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floodZero/subscriptions","organizations_url":"https://api.github.com/users/floodZero/orgs","repos_url":"https://api.github.com/users/floodZero/repos","events_url":"https://api.github.com/users/floodZero/events{/privacy}","received_events_url":"https://api.github.com/users/floodZero/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T05:56:05Z","updated_at":"2015-07-29T05:56:05Z","body":"OK, I requested PR from my fork.\r\nThank you. :)\r\n"}}