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

No longer accepts input from terminal after restart with --auto-update on Windows #151

Closed
niklasf opened this issue Dec 27, 2020 · 2 comments

Comments

@niklasf
Copy link
Member

niklasf commented Dec 27, 2020

When a new release is available, the current binary is replaced with the updated version. But how to restart properly?

On Unix it's easy to use exec() to replace the current process image:
https://github.com/niklasf/fishnet/blob/329c3eeeaa49c88589baea57282d9305e3217d40/src/main.rs#L351

So far I was not able to find an equivalent on Windows.

https://github.com/niklasf/fishnet/blob/329c3eeeaa49c88589baea57282d9305e3217d40/src/main.rs#L359


Upstream question: jaemk/self_update#62

@bharrisau
Copy link
Contributor

That looks like you are running exec inside the tokio runtime? Won't exec just never return, and you can potentially just keep stacking tokio runtimes on top of one another? I might be misunderstanding things.

@niklasf
Copy link
Member Author

niklasf commented Dec 29, 2020

It's the one from std::os::unix::process::CommandExt. Under the hood it uses the execvp syscall without forking, replacing the current process image instead of stacking a new one on top. All other threads should be destroyed by the operating system, not by properly shutting down tokio. So I guess it could leak some file descriptors, if any remain open at that point.

@niklasf niklasf changed the title Restart after --auto-update on Windows No longer accepts input from terminal after restart with --auto-update on Windows Sep 12, 2021
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

2 participants