I believe commit 9c0c0e68ac introduced a breaking change to what events are emitted from child process streams stdout/stderr.
const { spawn } = require('child_process')
const ps = spawn('ls', ['-al'])
ps.stdout.on('finish', function() {
console.log('Called `finish` on stdout')
});
ps.stdout.on('end', function() {
console.log('Called `end` on stdout')
});
ps.stderr.on('finish', function() {
console.log('Called `finish` on stderr')
});
ps.stderr.on('end', function() {
console.log('Called `end` on stderr')
});
In node v9.9.0
Called `end` on stderr
Called `end` on stdout
In node v9.8.0
Called `end` on stderr
Called `finish` on stderr
Called `end` on stdout
Called `finish` on stdout
Per the documentation, finish should only be associated with a writable stream, so the current behavior in 9.9.0 seems to be accurate. Given that, I'm not sure if the previous behavior was a bug or not.