[GH-ISSUE #293] Default console is not restored on destroy #846

Open
opened 2026-03-14 08:48:23 +03:00 by kerem · 1 comment
Owner

Originally created by @veracioux on GitHub (Nov 10, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/293

I did something like:

await new Promise<void>((resolve) => render(() => {
  const r = useRenderer()
  setTimeout(() => { r.destroy(); resolve() }, 500)
  return <box><text>test</text></box>
})

console.log("test") // Doesn't print

I looked at this method but I don't understand it: github.com/veracioux/opentui@931535a0b8/packages/core/src/console.ts (L151)

Don't these two snippets cancel each other out?

    if (this._originalConsole) {
      global.console = this._originalConsole
    }
    this.setupConsoleCapture()
Originally created by @veracioux on GitHub (Nov 10, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/293 I did something like: ``` await new Promise<void>((resolve) => render(() => { const r = useRenderer() setTimeout(() => { r.destroy(); resolve() }, 500) return <box><text>test</text></box> }) console.log("test") // Doesn't print ``` I looked at this method but I don't understand it: https://github.com/veracioux/opentui/blob/931535a0b8a8d9dcb712f186ed9979ee14c0e968/packages/core/src/console.ts#L151 Don't these two snippets cancel each other out? ``` if (this._originalConsole) { global.console = this._originalConsole } ``` ``` this.setupConsoleCapture() ```
Author
Owner

@kommander commented on GitHub (Nov 13, 2025):

That is confusing me as well. However the global.console replacement is capturing everything into a buffer, while the "override" just wraps the log/info/warn/error methods and caches it for display. One is probably redundant. The console needs some work.

<!-- gh-comment-id:3526317837 --> @kommander commented on GitHub (Nov 13, 2025): That is confusing me as well. However the `global.console` replacement is capturing everything into a buffer, while the "override" just wraps the log/info/warn/error methods and caches it for display. One is probably redundant. The console needs some work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#846
No description provided.