MCPcopy Index your code
hub / github.com/anomalyco/opencode / dispose

Function dispose

packages/opencode/src/plugin/tui/runtime.ts:424–461  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

422 }
423
424 const dispose = async () => {
425 if (done) return
426 done = true
427 ctrl.abort()
428 const queue = [...list].reverse()
429 list = []
430 const until = Date.now() + disposeTimeoutMs
431 for (const item of queue) {
432 const left = until - Date.now()
433 if (left <= 0) {
434 fail("timed out cleaning up tui plugin", {
435 path: load.spec,
436 id,
437 timeout: disposeTimeoutMs,
438 })
439 break
440 }
441
442 const out = await runCleanup(item.fn, left)
443 if (out.type === "ok") continue
444 if (out.type === "timeout") {
445 fail("timed out cleaning up tui plugin", {
446 path: load.spec,
447 id,
448 timeout: disposeTimeoutMs,
449 })
450 break
451 }
452
453 if (out.type === "error") {
454 fail("failed to clean up tui plugin", {
455 path: load.spec,
456 id,
457 error: out.error,
458 })
459 }
460 }
461 }
462
463 return {
464 lifecycle,

Callers

nothing calls this directly

Calls 6

runCleanupFunction · 0.85
deactivatePluginEntryFunction · 0.85
failFunction · 0.70
abortMethod · 0.45
disposeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected