0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-fs-read-stream-double-close.js
Matteo Collina b1fc7745f2 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>
2017-02-13 09:08:47 +01:00

12 lines
207 B
JavaScript

'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() {}