blob: 56537bd7fae94db5ab3f3e7d7e87e27cec5da8ff (
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
|
'use strict';
const common = require('../common');
const assert = require('assert');
const stream = require('stream');
let shutdown = false;
const w = new stream.Writable({
final: common.mustCall(function(cb) {
assert.strictEqual(this, w);
setTimeout(function() {
shutdown = true;
cb();
}, 100);
}),
write: function(chunk, e, cb) {
process.nextTick(cb);
}
});
w.on('finish', common.mustCall(function() {
assert(shutdown);
}));
w.write(Buffer.allocUnsafe(1));
w.end(Buffer.allocUnsafe(0));
|