criteo / command-launcher

A command launcher 🚀 made with ❤️
https://criteo.github.io/command-launcher
MIT License
35 stars 7 forks source link

Pkg install - Zip extraction - Close files as soon as they're copied. #130

Closed zeralight closed 10 months ago

zeralight commented 10 months ago

fix #130

Currently, the zip extraction opens all the files in the zip, copies them to the install directory, then closes them together.

This can lead to "too many open files" issue if the zip contains many files.

It happens because the defer zippedFile.Close() closes the file only at the end of the function, and not at the end of the current scope (for loop).

This PR addresses this limitation by shifting the extraction logic of a single file to a dedicated function. This way each file will be closed before we start to extract the next one.