[streams] pipeTo with preventClose: true returns a promise that is probably fulfilled too early (#314)

In IRC @tyoshino pointed out a potential issue with our pipeTo implementation. Related issues were previously discussed in https://github.com/whatwg/streams/issues/236#issue-46428456.

If you have `preventClose: false` (the default), then the returned promise will be fulfilled only once all the writes have successfully completed and the close succeeds.

However if you have `preventClose: false`, the returned promise will fulfill immediately once `source` is closed (empty) and `dest.ready` fulfills. This is probably earlier than the point in time when the last write succeeds.

I think the expected behavior for `preventClose: false` is for the promise to fulfill once the last write to `dest` succeeds.

This should be pretty easy to fix.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/314

Received on Monday, 6 April 2015 19:18:28 UTC