MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / #drain

Method #drain

src/utils/task/diskOutput.ts:207–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

205 }
206
207 async #drain(): Promise<void> {
208 try {
209 await this.#drainAllChunks()
210 } catch (e) {
211 // Transient fs errors (EMFILE on busy CI, EPERM on Windows pending-
212 // delete) previously rode up through `void this.#drain()` as an
213 // unhandled rejection while the flush promise resolved anyway — callers
214 // saw an empty file with no error. Retry once for the transient case
215 // (queue is intact if open() failed), then log and give up.
216 logError(e)
217 if (this.#queue.length > 0) {
218 try {
219 await this.#drainAllChunks()
220 } catch (e2) {
221 logError(e2)
222 }
223 }
224 } finally {
225 const resolve = this.#flushResolve!
226 this.#flushPromise = null
227 this.#flushResolve = null
228 resolve()
229 }
230 }
231}
232
233const outputs = new Map<string, DiskTaskOutput>()

Callers 1

appendMethod · 0.95

Calls 3

#drainAllChunksMethod · 0.95
logErrorFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected