Skip to content

fix: properly check for TTY support#19

Merged
Cod3ddy merged 1 commit into
mainfrom
fix/tty-check
Jun 1, 2026
Merged

fix: properly check for TTY support#19
Cod3ddy merged 1 commit into
mainfrom
fix/tty-check

Conversation

@Cod3ddy

@Cod3ddy Cod3ddy commented Jun 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

…er the given file descriptor is a terminal or not
@Cod3ddy

Cod3ddy commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

had a bug where sometimes the program could determine properly that the file desc was terminal and it supported TTY and sometimes it would fail to determine that.

it turns out the root cause was os.Stdin.Stat() in the root.go file, it checked filesystem mode bits, which , now i found out that don't reliably indicate a TTY.

The fix switches to term.IsTerminal() from the golang.org/x/term pkg which makes the correct ioctl(TIOCGETA) syscall, the same mechanism every shell and editor uses apparently.

@Cod3ddy Cod3ddy merged commit 36a0974 into main Jun 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant