diff options
author | Matteo Collina <hello@matteocollina.com> | 2017-02-07 19:38:33 +0100 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2017-02-13 09:08:47 +0100 |
commit | b1fc7745f2c7f279d388d8c88781df776b740259 (patch) | |
tree | 3fc4489218939e72fb845950756ab76a216ef701 /test/parallel/test-fs-read-stream-double-close.js | |
parent | 6dd979e67ce43beae56b06ed703ad8bd6a8f4370 (diff) | |
download | node-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.js | 11 |
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() {} |