node/test/parallel/test-stream2-finish-pipe-error.js
Robert Nagy 20d009d2fd
stream: pipe should not swallow error
PR-URL: https://github.com/nodejs/node/pull/30993
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-20 01:38:35 +01:00

21 lines
404 B
JavaScript

'use strict';
const common = require('../common');
const stream = require('stream');
process.on('uncaughtException', common.mustCall());
const r = new stream.Readable();
r._read = function(size) {
r.push(Buffer.allocUnsafe(size));
};
const w = new stream.Writable();
w._write = function(data, encoding, cb) {
cb(null);
};
r.pipe(w);
// end() after pipe should cause unhandled exception
w.end();