From 7b8c99069b7fe10f37131abb9bfb27e2d7669a6f Mon Sep 17 00:00:00 2001 From: Jacob Alzen Date: Fri, 25 Mar 2022 21:22:58 +0100 Subject: [PATCH] Copy directly to os.Stdout instead Closes: #76 [via git-merge-pr] --- cmd/recv.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/recv.go b/cmd/recv.go index 82761bee..619ecbb9 100644 --- a/cmd/recv.go +++ b/cmd/recv.go @@ -69,12 +69,15 @@ func recvAction(cmd *cobra.Command, args []string) { switch msg.Type { case wormhole.TransferText: - body, err := ioutil.ReadAll(msg) + _, err := io.Copy(os.Stdout, msg) if err != nil { log.Fatal(err) } - fmt.Println(string(body)) + _, err = os.Stdout.WriteString("\n") + if err != nil { + log.Fatal(err) + } case wormhole.TransferFile: var acceptFile bool if _, err := os.Stat(msg.Name); err == nil {