Closed
Description
The callback passed to WriteStream.close
function from the "fs" module is not called in certain situations (see below). The same applies to the ReadStream.
var fs = require('fs');
var a = fs.createWriteStream('/tmp/aaa');
a.close(console.log.bind(null, 'closed'));
// prints "closed"
a.close(console.log.bind(null, 'closed'));
// the "close" callback is not executed the second time
var fs = require('fs');
var a = fs.createWriteStream('/dev/full');
a.on('error', console.log.bind(null, 'error'));
a.write('a');
// prints "error"
a.close(console.log.bind(null, 'closed'));
// the "close" callback is not called after an error