Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

bisync: fix io.PipeWriter not getting closed on tests

nielashf995ece64d41
diff --git a/cmd/bisync/bilib/output.go b/cmd/bisync/bilib/output.go
index 22712e93b..ccd85c125 100644
--- a/cmd/bisync/bilib/output.go
+++ b/cmd/bisync/bilib/output.go
@@ -5,6 +5,7 @@ import (
"bytes"
"log"
+ "github.com/rclone/rclone/fs"
"github.com/sirupsen/logrus"
)
@@ -12,6 +13,12 @@ import (
func CaptureOutput(fun func()) []byte {
logSave := log.Writer()
logrusSave := logrus.StandardLogger().Writer()
+ defer func() {
+ err := logrusSave.Close()
+ if err != nil {
+ fs.Errorf(nil, "error closing logrusSave: %v", err)
+ }
+ }()
buf := &bytes.Buffer{}
log.SetOutput(buf)
logrus.SetOutput(buf)