mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:54:44 +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"
|
"bytes"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/rclone/rclone/fs"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,6 +13,12 @@ import (
|
|||||||
func CaptureOutput(fun func()) []byte {
|
func CaptureOutput(fun func()) []byte {
|
||||||
logSave := log.Writer()
|
logSave := log.Writer()
|
||||||
logrusSave := logrus.StandardLogger().Writer()
|
logrusSave := logrus.StandardLogger().Writer()
|
||||||
|
defer func() {
|
||||||
|
err := logrusSave.Close()
|
||||||
|
if err != nil {
|
||||||
|
fs.Errorf(nil, "error closing logrusSave: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
log.SetOutput(buf)
|
log.SetOutput(buf)
|
||||||
logrus.SetOutput(buf)
|
logrus.SetOutput(buf)
|
||||||
|
Loading…
Reference in New Issue
Block a user