From aeb8ea3973a7815fff7cbd16f986811baa08ae2f Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Wed, 13 Apr 2022 02:18:59 +0200 Subject: [PATCH] filter out useless commandConn.CloseWrite warning message Signed-off-by: CrazyMax --- cmd/dagger/cmd/root.go | 12 ++++++++++++ go.mod | 1 + 2 files changed, 13 insertions(+) diff --git a/cmd/dagger/cmd/root.go b/cmd/dagger/cmd/root.go index 304d7cdd..76672dc0 100644 --- a/cmd/dagger/cmd/root.go +++ b/cmd/dagger/cmd/root.go @@ -4,7 +4,9 @@ import ( "os" "strings" + "github.com/docker/buildx/util/logutil" "github.com/moby/buildkit/util/appcontext" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" "go.dagger.io/dagger/cmd/dagger/cmd/project" @@ -21,6 +23,16 @@ var rootCmd = &cobra.Command{ } func init() { + // filter out useless commandConn.CloseWrite warning message that can occur + // when dagger runs for the first time. This should be fixed upstream: + // unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed" + // https://github.com/docker/cli/blob/3fb4fb83dfb5db0c0753a8316f21aea54dab32c5/cli/connhelper/commandconn/commandconn.go#L203-L214 + logrus.AddHook(logutil.NewFilter([]logrus.Level{ + logrus.WarnLevel, + }, + "commandConn.CloseWrite:", + )) + rootCmd.PersistentFlags().String("log-format", "auto", "Log format (auto, plain, tty, json)") rootCmd.PersistentFlags().StringP("log-level", "l", "info", "Log level") rootCmd.PersistentFlags().Bool("experimental", false, "Enable experimental features") diff --git a/go.mod b/go.mod index 80baf1c8..d2aae972 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 github.com/rs/zerolog v1.26.1 github.com/sergi/go-diff v1.2.0 + github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 github.com/spf13/viper v1.10.0 github.com/stretchr/testify v1.7.1