Comments (14)
Good to know, will read up on that, cheers
from cargo-update.
Now old versions are removed at start, thanks for the suggestion
from cargo-update.
Another reference: Self-deleting Executables
from cargo-update.
I failed to make a cmd
process that hangs around after the main exec dies so that's POC for now
from cargo-update.
@nabijaczleweli I'm thinking to write a Windows-only method to do self-deleting
Gist will be here later
from cargo-update.
In the last resource you linked there's a mention of MoveFileEx()
with MOVEFILE_DELAY_UNTIL_REBOOT
, that sounds pretty ideal
from cargo-update.
@nabijaczleweli That won't help users which don't reboot frequently
from cargo-update.
I envisioned it as first moving it so the update will succeed then marking the moved (still running, but useless after it dies) exec as to delete at shutdown.
That way the user will have the updated version straight away and the old one (now renamed to sth like cargo-install-update.exe-v0.3.0
) will silently stop existing at shutdown when it's no longer used.
from cargo-update.
@nabijaczleweli
The gist here is a piece of pseudo-code to implement the self-deleting
Edit: The delete-after-reboot method won't work if the old exe still exists and another new version of cargo-update is installed without reboot. It will work, however leaving some unused binaries is not good experience for users.
from cargo-update.
How about this: when user checks update, cargo-update deletes old junks.
from cargo-update.
That's even less ideal tbh because you delay the delete until the next time the user checks for updates instead of next shutdown (also you risk false positives)
from cargo-update.
But my method means there will be at most 1 old version living with the newest version. And if user checks update multiple times between 2 reboots (which is more common, IMHO), the old version will be deleted silently.
Or you could implement both delete-after-reboot and delete-before-update.
I don't sure I get the meaning of "false positives", could you provide more details? Thanks!
Side note: If Windows cannot find the files which are marked as "delete after reboot", then it will ignore them silently.
PS: Maybe you could move the old executable to the Windows temporary directory, then when users clear their harddisk, the old version(s) will be deleted.
from cargo-update.
Released in v0.4.1
from cargo-update.
Yay!
from cargo-update.
Related Issues (20)
- Failure when using source replacement HOT 3
- error: registry index was not found in any configuration: `rsproxy-sparse` HOT 5
- Keep the features HOT 3
- Fails behind corporate proxy (but plain cargo install works) HOT 10
- respect previously defined feature flags when updating HOT 6
- Installing from source causes `cargo install` PATH warning on Windows due to path canonicalization HOT 7
- Internal matching of custom registry and source for sparse indices fails HOT 1
- Auto configuration error HOT 6
- Build fails on macOS 14.4.1 HOT 1
- build fails on arch linux 6.8.7-arch1-1 HOT 1
- `install.root` is not properly followed HOT 2
- Is there a way to list only packages in need of update? HOT 1
- Add --rate-limit flag HOT 2
- Unable to list/update packages after installing package using cargo binstall --git HOT 5
- When called from topgrade `cargo-install-update` under WSL fails to find some file or directory. HOT 5
- Prompt user before performing updates HOT 1
- FR: An option to disable some of `cargo binstall`'s strategies HOT 1
- Update to newer prerelease HOT 2
- cargo install-update doesn't install updates. HOT 8
- unnecessary configurations written to ~/.cargo/.install_config.toml HOT 4
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 cargo-update.