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

event close should be after data #19

Open
popomore opened this issue Dec 13, 2013 · 3 comments
Open

event close should be after data #19

popomore opened this issue Dec 13, 2013 · 3 comments

Comments

@popomore
Copy link

code

var proc = require('procstreams');

proc('echo 1')
  .data(function() {
    console.log('data');
  })
  .on('close', function() {
    console.log('close');
  });

terminal

close
data

Do you have any event execute after data?

@popomore
Copy link
Author

var proc = require('procstreams');

proc('echo 1', function(){
  console.log('callback')
}).data(function() {
  console.log('data');
}).on('exit', function() {
  console.log('exit');
}).on('close', function() {
  console.log('close');
}).on('_output', function() {
  console.log('_output');
}).stdout.on('end', function() {
  console.log('end');
})

output

exit
end
callback
close
data
_output

I find _output is the last event to be emit, any other choice?

@popomore
Copy link
Author

I can use process.nextTick

.on('close', function() {
    process.nextTick(function() {
      console.log('close');
    });
})

@polotek
Copy link
Owner

polotek commented Dec 14, 2013

I'm reopening this. If what you're seeing is true, this is a legitimate issue. You shouldn't have to use nextTick to work around it. But you should be aware that I haven't used this module in a long time and I'm not sure anyone else is. It is essentially unmaintained. If you want to look into this and send me a pull request, I would be happy to look at it though.

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

3 participants
@polotek @popomore and others