From 681b483803f1fa0eed948ad960d9387e28d3c390 Mon Sep 17 00:00:00 2001 From: acud <12988138+acud@users.noreply.github.com> Date: Wed, 5 May 2021 15:37:02 +0200 Subject: [PATCH 1/2] cmd: send version info to stdout --- cmd/bee/cmd/version.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/bee/cmd/version.go b/cmd/bee/cmd/version.go index ae2bf805796..74cf4f3268b 100644 --- a/cmd/bee/cmd/version.go +++ b/cmd/bee/cmd/version.go @@ -5,17 +5,21 @@ package cmd import ( + "os" + "github.com/ethersphere/bee" "github.com/spf13/cobra" ) func (c *command) initVersionCmd() { - c.root.AddCommand(&cobra.Command{ + v := &cobra.Command{ Use: "version", Short: "Print version number", Run: func(cmd *cobra.Command, args []string) { cmd.Println(bee.Version) }, - }) + } + v.SetOut(os.Stdout) + c.root.AddCommand(v) } From 0aff6abafda142db0e682ebeb9dd7d45f839bdf9 Mon Sep 17 00:00:00 2001 From: acud <12988138+acud@users.noreply.github.com> Date: Wed, 5 May 2021 17:04:14 +0200 Subject: [PATCH 2/2] pr review comments --- cmd/bee/cmd/version.go | 4 +--- pkg/p2p/libp2p/connections_test.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/bee/cmd/version.go b/cmd/bee/cmd/version.go index 74cf4f3268b..c438838f13d 100644 --- a/cmd/bee/cmd/version.go +++ b/cmd/bee/cmd/version.go @@ -5,8 +5,6 @@ package cmd import ( - "os" - "github.com/ethersphere/bee" "github.com/spf13/cobra" @@ -20,6 +18,6 @@ func (c *command) initVersionCmd() { cmd.Println(bee.Version) }, } - v.SetOut(os.Stdout) + v.SetOut(c.root.OutOrStdout()) c.root.AddCommand(v) } diff --git a/pkg/p2p/libp2p/connections_test.go b/pkg/p2p/libp2p/connections_test.go index 2ec9c7b0690..a089fc1b1c6 100644 --- a/pkg/p2p/libp2p/connections_test.go +++ b/pkg/p2p/libp2p/connections_test.go @@ -345,8 +345,8 @@ func TestBlocklisting(t *testing.T) { t.Fatal("expected error during connection, got nil") } - expectPeers(t, s1) - expectPeersEventually(t, s2) + expectPeersEventually(t, s1) + expectPeers(t, s2) } func TestTopologyNotifier(t *testing.T) {