mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 00:13:49 +01:00
bisync: fix io.PipeWriter not getting closed on tests
This commit is contained in:
parent
68c2ba74dd
commit
f995ece64d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user