Skip to content

Different behaviour between node 8 and 10 #15

@mbazalik

Description

@mbazalik

For some reason when an error is emitted on stream in node 8 this is propagated correctly and followed by end event, however on node 10, this happens in reverse order. (using latest 2.0.1 version of pumpify)

Example:

'use strict';

const { PassThrough, Writable } = require('stream');

const pumpify = require('pumpify');

const stream1 = new PassThrough();
const stream2 = new Writable();

const combined = pumpify(stream1, stream2);

combined.on('end', () => {
    console.log('Stream end');
});
combined.on('error', e => {
    console.log('Stream error: ', e);
});

stream1.emit('error', 'aaa');
nvm use 8
Now using node v8.17.0 (npm v6.13.4)

node tmp.js
Stream error:  aaa
Stream end
nvm use 10
Now using node v10.19.0 (npm v6.13.4)

node tmp.js
Stream end
Stream error:  aaa

Notice the reverse order of events.

Is this expected behaviour? Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions