fix(fs): fix fd leaking issue

This commit is contained in:
hexxa 2021-09-13 15:15:03 +08:00 committed by Hexxa
parent fb9de35e81
commit 50f66704b1
6 changed files with 96 additions and 39 deletions

View file

@ -62,6 +62,12 @@ func compareFileContent(fs fspkg.ISimpleFS, uid, filePath string, expectedConten
if err != nil {
return false, err
}
defer func() {
err = fs.CloseReader(filePath)
if err != nil {
fmt.Println(err)
}
}()
gotContent, err := ioutil.ReadAll(reader)
if err != nil {