Skip to content
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

Support self update #266

Open
sagiegurari opened this issue Jul 31, 2019 · 4 comments
Open

Support self update #266

sagiegurari opened this issue Jul 31, 2019 · 4 comments
Assignees

Comments

@sagiegurari
Copy link
Owner

Features Description
On linux/mac the exe is not locked while running so if the min version is defined, we could also have cargo-make validate and self update if need and configured to do so.
naturally windows is out of scope here.
(this is based on discussion in #265)

Describe the solution you'd like

[config]
min_version = "0.21.0"
self_update = true

In case the min version is higher then installed and self_update = true, cargo-make will first trigger self update and then restart.
restarted process would NOT support self update.

@kitlith
Copy link

kitlith commented Aug 1, 2019

on windows, would it be possible to download to another file, exec into a seperate exe/batch script, move the file, and then exec back?

EDIT: or, i suppose a seperate executable that performs the update of the first, and the first can update the update executable, etc.

@sagiegurari
Copy link
Owner Author

not sure its worth it.
but anyway you can't move or rename the files being executed.
usually you need to have another update process for this and I'm not planning to go there

@roblabla
Copy link
Contributor

roblabla commented Aug 1, 2019

Yeah windows support definitely involves a bit more logic, but it'd be really nice to have it there too. I think it could be done using a fairly simple process (assuming cargo is used to actually do the update):

  1. Copy self to new temporary location (Can get self with current_exe and open in read-only should work).
  2. Run self from new location with some kind of --trigger-update arg, then promptly die
  3. Have new process wait for parent to die, then trigger the update (letting cargo install the new version)
  4. Finally, run the updated executable with the original args

I'd be willing to implement and test something like that.

@sagiegurari
Copy link
Owner Author

Need a bit of time to think about this whole thing.
don't think we need to start copying exe files, instead we could (for windows) run a batch file from cargo-make, and in it:

  • kill/wait for cargo-make to end
  • run cargo install --force cargo-make
  • run original command

this batch could be generated in runtime by cargo-make using the input data we have from the cli and the current env (cwd and other related stuff).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants