Skip to content

fix: Avoid background color query hang#636

Open
jedevc wants to merge 1 commit intocharmbracelet:mainfrom
jedevc:fix-background-color-hang
Open

fix: Avoid background color query hang#636
jedevc wants to merge 1 commit intocharmbracelet:mainfrom
jedevc:fix-background-color-hang

Conversation

@jedevc
Copy link
Copy Markdown

@jedevc jedevc commented Mar 22, 2026

Which seems to happen if stdin/stdout are somehow accidentally not TTYs.

Potential fix for #635? Might need more fixes here, but this at least seems to make things work for my use case.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

Which seems to happen if stdin/stdout are somehow accidentally not TTYs.

Signed-off-by: Justin Chadwell <justin@unikraft.com>
@jedevc jedevc force-pushed the fix-background-color-hang branch from 46dd1f1 to 7237892 Compare March 23, 2026 14:04
}

// NOTE: On Unix, one of the given files must be a tty.
if !term.IsTerminal(in.Fd()) || !term.IsTerminal(out.Fd()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would skip querying when input OR output is not a terminal, in other words, when the program expects data from input as a file or stream or the output is redirected to a file or pipe.

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.

Apparent hang in HasDarkBackground when no TTY available

2 participants