Skip to content

Fix status line enabled when ANSI colors are forced#6503

Merged
rgrinberg merged 1 commit intoocaml:mainfrom
MisterDA:output_is_a_tty
Nov 17, 2022
Merged

Fix status line enabled when ANSI colors are forced#6503
rgrinberg merged 1 commit intoocaml:mainfrom
MisterDA:output_is_a_tty

Conversation

@MisterDA
Copy link
Copy Markdown
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 <antonin@tarides.com>
@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
Copy Markdown
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 <antonin@tarides.com>
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 <antonin@tarides.com>

Signed-off-by: Antonin Décimo <antonin@tarides.com>
Co-authored-by: Antonin Décimo <antonin@tarides.com>
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