From 16b54a53ae5885bd5353a481ba5c81e169b5658e Mon Sep 17 00:00:00 2001 From: kasperk81 <83082615+kasperk81@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:41:06 +0300 Subject: [PATCH 1/2] support NO_COLOR when selecting term Signed-off-by: kasperkantz --- commands/build.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/build.go b/commands/build.go index f51d8551f288..577545191192 100644 --- a/commands/build.go +++ b/commands/build.go @@ -308,8 +308,10 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) } var term bool - if _, err := console.ConsoleFromFile(os.Stderr); err == nil { - term = true + if _, err := console.ConsoleFromFile(os.Stdout); err == nil { + if _, exists := os.LookupEnv("NO_COLOR"); !exists { + term = true + } } attributes := buildMetricAttributes(dockerCli, b, &options) From 3df278d739aa1f8b4cdc49500590f5f2e8975eb2 Mon Sep 17 00:00:00 2001 From: kasperk81 <83082615+kasperk81@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:55:46 +0300 Subject: [PATCH 2/2] remove NO_COLOR --- commands/build.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/commands/build.go b/commands/build.go index 577545191192..678093aa2287 100644 --- a/commands/build.go +++ b/commands/build.go @@ -309,9 +309,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) var term bool if _, err := console.ConsoleFromFile(os.Stdout); err == nil { - if _, exists := os.LookupEnv("NO_COLOR"); !exists { - term = true - } + term = true } attributes := buildMetricAttributes(dockerCli, b, &options)