forked from TrueCloudLab/rclone
bisync: fix io.PipeWriter not getting closed on tests
This commit is contained in:
parent
68c2ba74dd
commit
f995ece64d
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue