Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behaviour between node 8 and 10 #15

Open
mbazalik opened this issue Jul 9, 2020 · 0 comments
Open

Different behaviour between node 8 and 10 #15

mbazalik opened this issue Jul 9, 2020 · 0 comments

Comments

@mbazalik
Copy link

mbazalik commented Jul 9, 2020

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?

Hexxeh added a commit to Fitbit/fitbit-sdk-toolchain that referenced this issue Mar 25, 2021
See: mafintosh/pumpify#15

Fortunately Node 10 adds a similar pipeline method built-in

Signed-off-by: Liam McLoughlin <[email protected]>
Hexxeh added a commit to Fitbit/fitbit-sdk-toolchain that referenced this issue Apr 20, 2021
See: mafintosh/pumpify#15

Fortunately Node 10 adds a similar pipeline method built-in

Signed-off-by: Liam McLoughlin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant