Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl request call callback function before get all stdout stream. #26

Closed
floodZero opened this issue Jul 29, 2015 · 2 comments
Closed

Comments

@floodZero
Copy link
Contributor

Hi, chriso.
I'm gavin of korea. (So, you could feel odd in my English.)

I found some issue on rapid request situation.
When curlrequest.request called rapidly, callback's data argument get "" string often.
With no error object and no stdrerr stream.
Also i checked packets, and it's good. there's no problem.

And I solved this issue, I think.

I changed bind of "exit" event to "close". And "" string output disappeared.

//Handle curl exit
curl.on('exit', function (code) {
  try {
    err = code;

to

curl.on('close', function (code) {
  try {
    err = code;

According to this API doc,
"exit" event can be emitted before stdout stream flushed.

How you think about this modification?

@chriso
Copy link
Contributor

chriso commented Jul 29, 2015

Thanks, it sounds like it should be close rather than exit. I'd be happy to accept a PR with the fix 😄

@floodZero
Copy link
Contributor Author

OK, I requested PR from my fork.
Thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants