Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-fs-stream-double-close.js « parallel « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae6429a62b4f3cab6b8f1cac0afb0e559acd68f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const common = require('../common');
const fs = require('fs');

common.refreshTmpDir();

test1(fs.createReadStream(__filename));
test2(fs.createReadStream(__filename));
test3(fs.createReadStream(__filename));

test1(fs.createWriteStream(common.tmpDir + '/dummy1'));
test2(fs.createWriteStream(common.tmpDir + '/dummy2'));
test3(fs.createWriteStream(common.tmpDir + '/dummy3'));

function test1(stream) {
  stream.destroy();
  stream.destroy();
}

function test2(stream) {
  stream.destroy();
  stream.on('open', common.mustCall(function(fd) {
    stream.destroy();
  }));
}

function test3(stream) {
  stream.on('open', common.mustCall(function(fd) {
    stream.destroy();
    stream.destroy();
  }));
}