From f995ece64d419e4b4dcda57748718b67dde46601 Mon Sep 17 00:00:00 2001 From: nielash Date: Sat, 6 Apr 2024 23:07:59 -0400 Subject: [PATCH] bisync: fix io.PipeWriter not getting closed on tests --- cmd/bisync/bilib/output.go | 7 +++++++ 1 file changed, 7 insertions(+) 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)