From 9ac5fd17a943cd564872bbbbd8bd19115ef3f518 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 19 Jul 2019 19:48:08 +0200 Subject: [PATCH] fs: don't double emit close on error --- lib/internal/fs/streams.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index dfff08dbbd1d2a..8812999d575fe4 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -217,11 +217,8 @@ ReadStream.prototype._destroy = function(err, cb) { function closeFsStream(stream, cb, err) { fs.close(stream.fd, (er) => { - er = er || err; - cb(er); + cb(er || err); stream.closed = true; - if (!er) - stream.emit('close'); }); }