bun icon indicating copy to clipboard operation
bun copied to clipboard

`stream/promises` `finished` function does not work

Open dalisoft opened this issue 1 year ago • 1 comments

What version of Bun is running?

1.1.1

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

  1. Clone repo
  2. Open folder
  3. Run bun run prepare.js
  4. See if file dprint or dprint.exe appears (not dprint.zip) after script finished

What is the expected behavior?

Script finishing and dprint or dprint.exe (on Windows) should appear. You can test by running node prepare.js.

What do you see instead?

Script not finishing and appears only first step of script until finished part. I see only dprint.zip file

Additional information

No response

dalisoft avatar Apr 06 '24 00:04 dalisoft

It also could be that Readable.fromWeb, specifically, is not emitting the event.

    const response = await fetch(asset.browser_download_url);
    const {body: bodyStream, status, ok} = response;
    if (!ok || status !== 200) {
        console.error({
            status,
            body: await response.text()
        });
        process.exit(1);
        return false;
    }
    await finished(Readable.fromWeb(bodyStream).pipe(createWriteStream(localURL + extension)));

Related: #10066

Electroid avatar Apr 08 '24 20:04 Electroid