Skip to content

Commit a85f626

Browse files
committed
fix(core): treat 0 tty cols/rows as invalid
1 parent 2efcd14 commit a85f626

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/core/src/renderer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,10 @@ export class CliRenderer extends EventEmitter implements RenderContext {
503503
this.stdout = stdout
504504
this.realStdoutWrite = stdout.write
505505
this.lib = lib
506-
this._terminalWidth = stdout.columns ?? width
507-
this._terminalHeight = stdout.rows ?? height
506+
// In Bun compiled binaries, tty streams may report columns/rows as 0 even when isTTY is true.
507+
// Treat non-positive values as invalid and fall back to the renderer's initial dimensions.
508+
this._terminalWidth = typeof stdout.columns === "number" && stdout.columns > 0 ? stdout.columns : width
509+
this._terminalHeight = typeof stdout.rows === "number" && stdout.rows > 0 ? stdout.rows : height
508510
this.width = width
509511
this.height = height
510512
this._useThread = config.useThread === undefined ? false : config.useThread

0 commit comments

Comments
 (0)