tapjs / tap-parser

parse the test anything protocol
121 stars 35 forks source link

Parser stops consuming lines if stdin is slow #59

Closed epoberezkin closed 7 years ago

epoberezkin commented 7 years ago

Running

something_slow | tap-parser --lines

consistently stops consuming lines somewhere mid-way after couple of thousands lines.

This always works ok:

something_slow > temp.txt
cat temp.txt | tap-parser --lines

@isaacs any idea how to investigate would be helpful.

epoberezkin commented 7 years ago

Ok, so it is caused by calling process.exit(0) in the app that produces tap output.

With and without process.exit(0) this works correctly:

node app > tap.txt
cat tap.txt | tap-parser --lines

Piping only works without process.exit():

node app | tap-parser --lines

I don't think it's the issue of this package, but maybe somebody knows why?

epoberezkin commented 7 years ago

Seems related: https://github.com/nodejs/node/issues/9633

epoberezkin commented 7 years ago

ok, so process.exit kills output and writing to file works because it is faster.