Skip to content

Stream.pipeline() does not call the callback on completion #34059

Closed
@matdodgson

Description

@matdodgson
  • Version: 12.18.0 and 14.4.0
  • Platform: Ubuntu 20.04 LTS
  • Subsystem:

I use the following code to test the callback of the pipeline() function under node 12.18.0 and node 14.4.0:

'use strict';

import {pipeline, Readable} from 'stream';
import {createWriteStream} from 'fs';

pipeline(
    Readable.from(['a', 'b', 'c', '\r\n']),
    process.stdout,
    (err) => {
        console.log('finish callback stdout');
    }
);

pipeline(
    Readable.from(['a', 'b', 'c', '\r\n']),
    createWriteStream('outfile.txt'),
    (err) => {
        console.log('finish callback file write stream');
    }
);

Under Node 12.18.0, the callback on the second pipeline() is called on completion, but the callback on the first is not.
Same problem on Node 14.4.0.

Related to #26550 and maybe also #33237

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions