From 4c74b5927a25ca2a82c4f7a910388fab5059560e Mon Sep 17 00:00:00 2001 From: acud <12988138+acud@users.noreply.github.com> Date: Wed, 5 May 2021 18:28:38 +0200 Subject: [PATCH] cmd: send version info to stdout (#1660) --- cmd/bee/cmd/version.go | 6 ++++-- pkg/p2p/libp2p/connections_test.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/bee/cmd/version.go b/cmd/bee/cmd/version.go index ae2bf805796..c438838f13d 100644 --- a/cmd/bee/cmd/version.go +++ b/cmd/bee/cmd/version.go @@ -11,11 +11,13 @@ import ( ) 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(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) {