mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 20:46:16 +00:00

Changes so that the end() callback behaves the same way in relation to _final as write() does to _write/_writev. PR-URL: https://github.com/nodejs/node/pull/34101 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
24 lines
511 B
JavaScript
24 lines
511 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const stream = require('stream');
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'kaboom');
|
|
}));
|
|
|
|
const writable = new stream.Writable();
|
|
|
|
writable._write = (chunk, encoding, cb) => {
|
|
cb();
|
|
};
|
|
writable._final = (cb) => {
|
|
cb(new Error('kaboom'));
|
|
};
|
|
|
|
writable.write('asd');
|
|
writable.end(common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED');
|
|
}));
|