-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
.pipeTo(Writable.toWeb(process.stdout))
returns a never-settling Promise
#56139
Comments
Some (small followups): Simplified to get rid of import { Writable } from 'node:stream'
import { ReadableStream } from 'node:stream/web'
await ReadableStream.from(["test"]).pipeTo(Writable.toWeb(process.stdout))
Without import { ReadableStream } from 'node:stream/web'
await ReadableStream.from(["test"]).pipeTo(new WritableStream()) And just to make sure let's implement a naive implementation of a import { ReadableStream } from 'node:stream/web'
import { setTimeout } from 'node:timers/promises'
const streamWritable = process.stdout
await ReadableStream.from(["test"]).pipeTo(new WritableStream({
write(chunk) {
if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) {
return new Promise(resolve => streamWritable.once('drain', resolve))
}
},
close() {
return setTimeout(1000)
}
})) |
The problem is not that there's a warning, it's that the promise never resolves: $ node -e '
const {Writable} = require("node:stream");
const {ReadableStream} = require("node:stream/web");
ReadableStream.from(["test\n"]).pipeTo(Writable.toWeb(process.stdout)).then(() => console.log("Done"), console.error)'
test
$ echo $?
0 As you can see, the |
.pipeTo(Writable.toWeb(process.stdout))
results in warning.pipeTo(Writable.toWeb(process.stdout))
returns a never-settling Promise
Indeed. I had a few extra minutes to do some initial testing. I looks like when the code gets here I'm guessing So that was me not setting up my debugging env propperly, the |
I decided to go in a slightly different direction and started testing with different node version, and it look like this works in |
It could be related to a V8 update, or another semver-major commit of v22.x but I don't see any related |
Oh well, I guess it's nice to have found something new rather than a regression 🤷 |
Version
Platform
Subsystem
node:stream
What steps will reproduce the bug?
create file
test.mjs
run
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
no warning,
await
to work as expectedWhat do you see instead?
warning about unsettled top-level await is shown
Additional information
No response
The text was updated successfully, but these errors were encountered: