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 output capture restoring the wrong output for logrus

Dimitrios Slamarisabe884e74473
diff --git a/cmd/bisync/bilib/output.go b/cmd/bisync/bilib/output.go
index ccd85c125..c35abde86 100644
--- a/cmd/bisync/bilib/output.go
+++ b/cmd/bisync/bilib/output.go
@@ -5,20 +5,13 @@ import (
"bytes"
"log"
- "github.com/rclone/rclone/fs"
"github.com/sirupsen/logrus"
)
// CaptureOutput runs a function capturing its output.
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)
- }
- }()
+ logrusSave := logrus.StandardLogger().Out
buf := &bytes.Buffer{}
log.SetOutput(buf)
logrus.SetOutput(buf)