|
@ -151,3 +151,41 @@ stream.on('end', function() { |
|
|
var pauseRes = fs.createReadStream(rangeFile); |
|
|
var pauseRes = fs.createReadStream(rangeFile); |
|
|
pauseRes.pause(); |
|
|
pauseRes.pause(); |
|
|
pauseRes.resume(); |
|
|
pauseRes.resume(); |
|
|
|
|
|
|
|
|
|
|
|
var file7 = fs.createReadStream(rangeFile, {autoClose: false }); |
|
|
|
|
|
file7.on('data', function() {}); |
|
|
|
|
|
file7.on('end', function() { |
|
|
|
|
|
process.nextTick(function() { |
|
|
|
|
|
assert(!file7.closed); |
|
|
|
|
|
assert(!file7.destroyed); |
|
|
|
|
|
file7Next(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function file7Next(){ |
|
|
|
|
|
// This will tell us if the fd is usable again or not.
|
|
|
|
|
|
file7 = fs.createReadStream(null, {fd: file7.fd, start: 0 }); |
|
|
|
|
|
file7.data = ''; |
|
|
|
|
|
file7.on('data', function(data) { |
|
|
|
|
|
file7.data += data; |
|
|
|
|
|
}); |
|
|
|
|
|
file7.on('end', function(err) { |
|
|
|
|
|
assert.equal(file7.data, 'xyz\n'); |
|
|
|
|
|
process.nextTick(function() { |
|
|
|
|
|
assert(file7.closed); |
|
|
|
|
|
assert(file7.destroyed); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Just to make sure autoClose won't close the stream because of error.
|
|
|
|
|
|
var file8 = fs.createReadStream(null, {fd: 13337, autoClose: false }); |
|
|
|
|
|
file8.on('data', function() {}); |
|
|
|
|
|
file8.on('error', common.mustCall(function() {})); |
|
|
|
|
|
file8.on('end', function() { |
|
|
|
|
|
process.nextTick(function() { |
|
|
|
|
|
assert(!file8.closed); |
|
|
|
|
|
assert(!file8.destroyed); |
|
|
|
|
|
assert(file8.fd); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|