Skip to content
Myr

fix(utils/stream): re-acquire writer lock when pipe() throws (#4988)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sriharsha-dev369 · committed by GitHub · parent 569b419 · Browse files · 2 files+43 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+43 added−2 removed

  • tests:+38 added−0 removed
  • other:+5 added−2 removed

2 files+43 added−2 removed

modified:src/utils/stream.test.ts+38 added
modified:src/utils/stream.ts+5 added-2 removed
75 unmodified lines
76 }7778 async pipe(body: ReadableStream) {79 this.writer.releaseLock()80 await body.pipeTo(this.writable, { preventClose: true })81 this.writer = this.writable.getWriter()80 try {81 await body.pipeTo(this.writable, { preventClose: true, preventAbort: true })82 } finally {83 this.writer = this.writable.getWriter()84 }85 }8687 onAbort(listener: () => void | Promise<void>) {88 this.abortSubscribers.push(listener)
13 unmodified lines