Comments (10)
@abourget I'm still experiencing this issue. As soon as I comment out any reference to go.rice, renaming the exe works fine. However, when I have go.rice in the app, I get the "in use" error.
My app is a CLI that has a single command to generate an example config file (from the rice box). I try to update inside of another command. It seems strange to me that rice opens the exe even when it's not being utilized.
I trust your PR fixed it back in 2015? Any ideas as to why it's no longer working?
from go-update.
This document: http://www.catch22.net/tuts/self-deleting-executables lists MoveFileEx
as the solution to rename a running file, with the MOVEFILE_DELAY_UNTIL_REBOOT
flag.. we're using os.Rename
.. are we sure this is what is called underneath ?
from go-update.
that MOVEFILE_DELAY_UNTIL_REBOOT
isn't the solution.. as the file stays there until a reboot is performed.. we need to zap it out right away.
The only solution I see is to write a .bat
file that will delete the executable, and rename the .new
one, and restart the process.. and then kill the current process, after forking the cmd
for the .bat
file...
All that seems a bit hairy, but I don't understand how it works on your machines.. it seems to me that Windows can not delete or move or rename a running file.
from go-update.
So, as far as i understand it, windows can't delete the executable file of a running process. Windows can rename the executable file of a running process. See: https://superuser.com/questions/488127/why-can-i-rename-a-running-executable-but-not-delete-it
go-update is cognizant of this. On nix systems, go-update deletes the old executable but on Windows we just hide it because of that problem.
If you're encountering an issue where go-update is failing to rename the running executable, it's very likely that your program (or another program) has an open file handle to the executable file.
from go-update.
Right.. I think my process does indeed open itself because of go-rice
... so I'll close this.. I'll find another way.
from go-update.
ahhh, that makes a lot of sense. you might try the option where generate the source code files to be included in the binary instead of having them appended as a zipfile. it looks like go-rice supports that. for ngrok I use go-bindata which has been very effective
from go-update.
I've got a PR over there to fix the issue. GeertJohan/go.rice#39
thanks :)
from go-update.
awesome! thanks for tracking this down!
from go-update.
yeah, go.rice supports http.Filesystem
, so you can navigate through files and not have to list all the files up front (say you add a new .html file after), I recall go-bindata requires you to run some more stuff to pick up the new files..
from go-update.
I've ended up using https://github.com/mjibson/esc instead of rice.
from go-update.
Related Issues (20)
- Attack possible by downgrading to earlier exploitable binary version by MITM HOT 5
- Quick Start Documentation HOT 1
- Tag release HOT 2
- can i get complete example program to understand self update usage? HOT 3
- Are you providing support for linux too? HOT 1
- Release osext as an independent package HOT 1
- Bug in Example? HOT 2
- Make switch of files more robust
- x HOT 1
- Wrong permissions HOT 1
- McAfee virus scanner cleans the new exe after update HOT 1
- example handler HOT 1
- Restart process after update HOT 3
- progress prompt
- Check directory permissions and throw an informative error when they are wrong
- Will this work inside a Macos dmg application? HOT 1
- Support go modules
- THIS PROJECT APPEARS TO BE UNMAINTAINED (details inside) HOT 2
- Equinox is shutting down on September 30th, 2021 HOT 1
- Self-update in parallel processes does not work properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-update.