I ran into this issue with our build system which is concurrently generating loads of sprites (ie. maxing out cpu). I was able to reproduce this with Amazon AMI Linux as well as Ubuntu Linux (running in AWS as well). Also I tried with Node 6.x and 8.x - both behaving similarly. I wrote a small script to reproduce this behaviour with a simple 'cat' operation piping a large text file to stdout and listening to the 'exit' event. Changing the 'exit' to 'close' fixed the problem.
Audiosprite spawns ffmpeg with stdout pipe when it generates sprites. It is listening for the 'exit' event instead of 'close' which causes the piped stdout stream to sometimes be incomplete before the sprite is generated: https://github.com/tonistiigi/audiosprite/blob/c487140ecc2f3ad2efcadf515e68603b1f300737/audiosprite.js#L118
I ran into this issue with our build system which is concurrently generating loads of sprites (ie. maxing out cpu). I was able to reproduce this with Amazon AMI Linux as well as Ubuntu Linux (running in AWS as well). Also I tried with Node 6.x and 8.x - both behaving similarly. I wrote a small script to reproduce this behaviour with a simple 'cat' operation piping a large text file to stdout and listening to the 'exit' event. Changing the 'exit' to 'close' fixed the problem.
Link to the 'close' event documentation: https://nodejs.org/api/child_process.html#child_process_event_close
Some related discussion: https://stackoverflow.com/questions/37522010/difference-between-childprocess-close-exit-events
Let me know if you need more details on this.