-
Notifications
You must be signed in to change notification settings - Fork 244
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
old exe not deleted on Windows #1
Comments
Thanks for opening this. I think it's definitely go-update's problem to solve, and I don't have a clean solution beyond simply running os.Remove(oldBinaryPath) and ignoring "file does not exist" errors before the update happens. This will clean it out on the next update run, which is sub-optimal but I can't think of a better solution. I'm open to suggestions though. |
That was my first thought as well. There are some really ugly ways that Windows devs accomplish this: http://www.catch22.net/tuts/self-deleting-executables One other possibility might be to move the old executable to a temp or trash dir instead of moving it to the same dir. That being said, unless you're running your exe from somewhere highly visible like the Desktop, it's unlikely that most users would notice / care if the old one was left around. I think the simple approach you mentioned is probably good enough for now. |
Wow, that's quite a list. I agree with you about the options, and I'll add one more suggestion. Windows has an API for making files hidden (via SetFileAttributes). Making the old executable a hidden file means it wouldn't show up somewhere noticeable and you could delete it at the time of next update. |
Alright, I just pushed a fix that makes sure the file it tries to rename to is always deleted before attempting the move. I'm leaving this issue open though because it would be nice to make the removal cleaner or at least less noticeable (via hidden file). |
Urgh, didn't want github to auto-close this. The hidden file mechanism is implemented now, which is a little less onerous, but I want to leave this open until such point as a real solution is implemented with one of the mechanisms described in the article. |
why cant you just name the "old" file like that: .prog-04-04-2018-13-56.old |
i solved the problem with:
|
I think you mentioned that this was still a problem for you. We've got the same problem in
hk
at the moment since we can't delete a running executable on Windows.Just curious how you were planning on solving this one (and if this is the right place for it, or if you consider that
ngrok
's problem to solve).The text was updated successfully, but these errors were encountered: