mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
fix: missing file closding when printing downloading percent of gf cli file for command gf up (#3483)
This commit is contained in:
@ -69,16 +69,18 @@ func doPrintDownloadPercent(doneCh chan int64, localSaveFilePath string, total i
|
||||
stop = false
|
||||
lastPercentFmt string
|
||||
)
|
||||
file, err := os.Open(localSaveFilePath)
|
||||
if err != nil {
|
||||
mlog.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-doneCh:
|
||||
stop = true
|
||||
|
||||
default:
|
||||
file, err := os.Open(localSaveFilePath)
|
||||
if err != nil {
|
||||
mlog.Fatal(err)
|
||||
}
|
||||
fi, err := file.Stat()
|
||||
if err != nil {
|
||||
mlog.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user