summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-read-stream-double-close.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2017-02-07 19:38:33 +0100
committerMatteo Collina <hello@matteocollina.com>2017-02-13 09:08:47 +0100
commitb1fc7745f2c7f279d388d8c88781df776b740259 (patch)
tree3fc4489218939e72fb845950756ab76a216ef701 /test/parallel/test-fs-read-stream-double-close.js
parent6dd979e67ce43beae56b06ed703ad8bd6a8f4370 (diff)
downloadnode-new-b1fc7745f2c7f279d388d8c88781df776b740259.tar.gz
fs: avoid emitting error EBADF for double close
Changed the logic in fs.ReadStream and fs.WriteStream so that close always calls the prototype method rather than the internal event listener. Fixes: https://github.com/nodejs/node/issues/2950 PR-URL: https://github.com/nodejs/node/pull/11225 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'test/parallel/test-fs-read-stream-double-close.js')
-rw-r--r--test/parallel/test-fs-read-stream-double-close.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/parallel/test-fs-read-stream-double-close.js b/test/parallel/test-fs-read-stream-double-close.js
new file mode 100644
index 0000000000..e18bc6b4fb
--- /dev/null
+++ b/test/parallel/test-fs-read-stream-double-close.js
@@ -0,0 +1,11 @@
+'use strict';
+
+const common = require('../common');
+const fs = require('fs');
+
+const s = fs.createReadStream(__filename);
+
+s.close(common.mustCall(noop));
+s.close(common.mustCall(noop));
+
+function noop() {}