Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status line enabled when ANSI colors are forced #6503

Merged
merged 1 commit into from
Nov 17, 2022

Conversation

MisterDA
Copy link
Contributor

We want to enable the status line if and only if stderr is a tty. ANSI color usage was tweaked in 3.6.0 with #6340 to allow users to force colors. As status line activation actually depended on whether ANSI colors were enabled or not, this change had the side effect to always enable the status line even when ANSI colors were requested for something that's not a tty.

Fix this by exposing a simple lazy wrapper of Unix.isatty to use instead of Ansi_color.stderr_supports_color.

We want to enable the status line if and only if stderr is a tty. ANSI
color usage was tweaked in 3.6.0 with ocaml#6340 to allow users to force
colors. As status line activation actually depended on whether ANSI
colors were enabled or not, this change had the side effect to always
enable the status line even when ANSI colors were requested for
something that's not a tty.

Fix this by exposing a simple lazy wrapper of Unix.isatty to use
instead of Ansi_color.stderr_supports_color.

Signed-off-by: Antonin Décimo <[email protected]>
@rgrinberg rgrinberg added this to the 3.7.0 milestone Nov 17, 2022
@rgrinberg rgrinberg merged commit 0280c9e into ocaml:main Nov 17, 2022
@MisterDA MisterDA deleted the output_is_a_tty branch November 17, 2022 23:59
@emillon
Copy link
Collaborator

emillon commented Nov 18, 2022

FTR I'd like to backport that to 3.6.x

@emillon emillon modified the milestones: 3.7.0, 3.6.1 Nov 23, 2022
emillon pushed a commit to emillon/dune that referenced this pull request Nov 24, 2022
We want to enable the status line if and only if stderr is a tty. ANSI
color usage was tweaked in 3.6.0 with ocaml#6340 to allow users to force
colors. As status line activation actually depended on whether ANSI
colors were enabled or not, this change had the side effect to always
enable the status line even when ANSI colors were requested for
something that's not a tty.

Fix this by exposing a simple lazy wrapper of Unix.isatty to use
instead of Ansi_color.stderr_supports_color.

Signed-off-by: Antonin Décimo <[email protected]>
emillon added a commit that referenced this pull request Nov 24, 2022
We want to enable the status line if and only if stderr is a tty. ANSI
color usage was tweaked in 3.6.0 with #6340 to allow users to force
colors. As status line activation actually depended on whether ANSI
colors were enabled or not, this change had the side effect to always
enable the status line even when ANSI colors were requested for
something that's not a tty.

Fix this by exposing a simple lazy wrapper of Unix.isatty to use
instead of Ansi_color.stderr_supports_color.

Signed-off-by: Antonin Décimo <[email protected]>

Signed-off-by: Antonin Décimo <[email protected]>
Co-authored-by: Antonin Décimo <[email protected]>
emillon added a commit to emillon/opam-repository that referenced this pull request Nov 24, 2022
…ne-site, dune-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info, dune-action-plugin and chrome-trace (3.6.1)

CHANGES:

- Fix status line enabled when ANSI colors are forced. (ocaml/dune#6503, @MisterDA)

- Fix build with MSVC compiler (ocaml/dune#6517, @nojb)

- Do not shadow library interface modules (ocaml/dune#6549, fixes ocaml/dune#6545, @rgrinberg)
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.

3 participants