-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Feature request: Make v up
work on windows.
#16184
Comments
v update
work on windows.v up
work on windows.
Or, rather all the |
It's not entirely clear, where is it coming from, that For instance, on two computers that I tested |
Sometimes it looks like it worked, but if you compare the hash before/after, it is the same. that's because If it actually works for you somehow, it is a fluke that doesn't work on any Windows system I have tried in the past. |
Agreed. It can't work as it is currently implemented on Windows.
That makes sense.
@Wajinn can you confirm it actually worked? Compare before and after hash? |
Yes, I took a Windows box from 0.3.1 to 0.3.2. So I'm not sure what the source of the original issue was, if the person is not using Windows. However, I don't see anything wrong with your feature request, just that other developers who are testing on Windows should probably chime in on what they think. If you guys find some other ways to update v on Windows, I guess that's good. Keep in mind, a huge number of users and potential users will be on Windows.
I did initially have an interesting problem though, with fn.v. I had to delete the file, and then the update went smoothly. Not sure yet what that was all about.
|
@bogen85 , @JalonSolov , ... I ran into this when installing The real blocker is that the I've got a local version of I'll post a PR later tonight after my local CI runs finish. |
- use move semantics, instead of replace, for `v` executable updates - fixes [vlang#16184](vlang#16184) # [why] `v up` updates the executable by directly calling `make.bat`, awaiting the result, which keeps an open file handle to it's own executable file. `make.bat` compiles and, crucially, attempts to directly replace that `v` executable. But, in WinOS, files with open file handles cannot be deleted/replaced, so the `make` then fails. The other key point is that, although WinOS files with open file handles can't be deleted/replaced, they _can be moved/renamed_. Thus, the technique that most self-updating WinOS executables use is to move the current executable to some alternate name (ie, *v_old.exe*) and then move the newly updated executable to the original location (ie, *v.exe*). The next invocation of the "original" executable will then run the updated version. Note, this technique also works correctly for direct invocations of `make.bat`.
PR #16348 fixing this is now posted. |
* .editorconfig: fix EOL for BAT files * make.bat: fix use of `make.bat` from `v up` - use move semantics, instead of replace, for `v` executable updates - fixes [#16184](#16184) # [why] `v up` updates the executable by directly calling `make.bat`, awaiting the result, which keeps an open file handle to it's own executable file. `make.bat` compiles and, crucially, attempts to directly replace that `v` executable. But, in WinOS, files with open file handles cannot be deleted/replaced, so the `make` then fails. The other key point is that, although WinOS files with open file handles can't be deleted/replaced, they _can be moved/renamed_. Thus, the technique that most self-updating WinOS executables use is to move the current executable to some alternate name (ie, *v_old.exe*) and then move the newly updated executable to the original location (ie, *v.exe*). The next invocation of the "original" executable will then run the updated version. Note, this technique also works correctly for direct invocations of `make.bat`.
v up
does not work on windows.I currently don't have access to windows to confirm this or to implement is feature.
This arose from a recent discussion in V's
#help
on discord.TLDR: Windows won't allow a running executable to be rewritten.
Any changes for this feature request only apply to Windows, *nix flavors and distros don't need this feature, as
v up
already works for them.This also does not apply to using
v
with WSL, as long as thev
location is not on a regular Windows Filesystem.WSL controlled mounts/directories should act like filesystems do on *nix flavors and distros.
The following are suggestions only. How it actually gets implemented is not he issue here.
However it is implemented it just needs to work given that 'Windows won't allow a running executable to be rewritten'.
What could be done to make this work.
v up
copiesv
somewhere else.v
is launched with an indication of what had happened. (possibly with something likev up --stage2
)v
quits.v
waits for the firstv
to quit.v
quits.Optional of what else could be done.
v
asking it too delete the stage 2v
from above.v
quits.v
waits for the now stale stage2 to quit.v
deletes the stale stage2v
v
quits.Potential blockers
If the Potential blockers are an issue, then the update stages must accommodate and handle that cleanly (or with applicable error message indicating what the problem.
The text was updated successfully, but these errors were encountered: