File downloaded file gets truncated in linux if calling quitAndInstall.
See original GitHub issueI am trying to implement automatic updates, so when the newer file is downloaded I want to quitAndInstall in order to use the new version. However the problem is that when I call quitAndInstall
from the update-downloaded
listener handler, the file gets truncated to around half the size (the file is around 100Mb, and it ends in between 50Mb and 40Mb, it is not deterministic. Makes me think that when the update-downladed
event is triggered, the file has not been completely flushed to disk, so if you quit too quickly you end with a truncated file. If I do not call quitAndInstall
then the file is downloaded correctly and if I manually quit and start the new version will work.
Coincidentally this made me wonder, what would happen if the download fails before the new version has been completely downloaded? currently it is overwriting the older version, so if it fails it seems like you end up with a broken app. This is normally resolved by saving to a new name and then doing a rename when ready, however I do not know if it is possible to do an atomic remove (old version) and rename (new version) so that it is guaranteed that you will broke an existing app.
Any insights ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (4 by maintainers)
Top GitHub Comments
FIxed in v2.0.11
Sorry, sometimes I absolutely have no time for opensource. Anyway, I still have plans to make a release on the week.