Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParallelDownload does not close output file after download completed and merged? #416

Open
ZHOUYue67 opened this issue Jan 26, 2025 · 0 comments

Comments

@ZHOUYue67
Copy link

ZHOUYue67 commented Jan 26, 2025

The *os.File returned by getOutputFile() never seems to get closed in mergeFile(). Is this a bug, or I'm using this the wrong way?

(Windows平台)用了ParallelDownload后立马os.Rename()文件会失败,提示文件正在被使用,我把parallel_download.go单独拿出来改,在mergeFile()里加上等同于defer file.Close()的代码,就可以正确使用了。
虽然os/file_windows.gonewFile()里,存在runtime.SetFinalizer(f.file, (*file).close),但还是建议可控环境下主动调用os.File.Close()

@ZHOUYue67 ZHOUYue67 reopened this Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant