Procházet zdrojové kódy

Merge pull request #9748 from crazy-max/log-filter

root: filter out commandConn.Close* warning message
Guillaume Lours před 3 roky
rodič
revize
8d12042f39
1 změnil soubory, kde provedl 11 přidání a 0 odebrání
  1. 11 0
      cmd/compose/compose.go

+ 11 - 0
cmd/compose/compose.go

@@ -28,6 +28,7 @@ import (
 	"github.com/compose-spec/compose-go/cli"
 	"github.com/compose-spec/compose-go/types"
 	composegoutils "github.com/compose-spec/compose-go/utils"
+	"github.com/docker/buildx/util/logutil"
 	dockercli "github.com/docker/cli/cli"
 	"github.com/docker/cli/cli-plugins/manager"
 	"github.com/docker/cli/cli/command"
@@ -250,6 +251,16 @@ func RunningAsStandalone() bool {
 
 // RootCommand returns the compose command with its child commands
 func RootCommand(dockerCli command.Cli, backend api.Service) *cobra.Command {
+	// filter out useless commandConn.CloseWrite warning message that can occur
+	// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
+	// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215
+	logrus.AddHook(logutil.NewFilter([]logrus.Level{
+		logrus.WarnLevel,
+	},
+		"commandConn.CloseWrite:",
+		"commandConn.CloseRead:",
+	))
+
 	opts := projectOptions{}
 	var (
 		ansi    string