Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import { pipeTo } from "node:stream/iter";
import { setTimeout } from "node:timers/promises";
async function* neverYieldingSource() {
await new Promise(() => {});
}
const writer = {
write() {},
};
const ac = new AbortController();
setTimeout(100).then(() => {
ac.abort(new Error("abort reason"));
});
const result = await Promise.race([
pipeTo(neverYieldingSource(), writer, { signal: ac.signal }).then(
() => "pipeTo resolved",
(error) => `pipeTo rejected: ${error.name}: ${error.message}`,
),
setTimeout(1000, "timed out"),
]);
console.log(result);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
pipeTo rejected: Error: abort reason
pipeTo() should reject promptly when options.signal aborts, even while waiting for the next source chunk in the no-transform path.
What do you see instead?
pipeTo() checks signal.throwIfAborted() only after for await produces a batch, so a pending source read that never settles prevents abort from being observed.
Additional information
No response
Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
pipeTo rejected: Error: abort reasonpipeTo()should reject promptly whenoptions.signalaborts, even while waiting for the next source chunk in the no-transform path.What do you see instead?
timed outpipeTo()checkssignal.throwIfAborted()only afterfor awaitproduces a batch, so a pending source read that never settles prevents abort from being observed.Additional information
No response