feat(core): mark AppHandle::restart and process::restart as diverging functions (#10171)

closes #10160
This commit is contained in:
Amr Bashir 2024-07-02 13:58:34 +03:00 committed by GitHub
parent eeae0660e1
commit a7354f9a81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": "patch:enhance"
---
Mark `AppHandle::restart` and `process::restart` as [diverging functions](https://doc.rust-lang.org/rust-by-example/fn/diverging.html).

View File

@ -417,7 +417,7 @@ impl<R: Runtime> AppHandle<R> {
}
/// Restarts the app by triggering [`RunEvent::ExitRequested`] with code [`RESTART_EXIT_CODE`] and [`RunEvent::Exit`]..
pub fn restart(&self) {
pub fn restart(&self) -> ! {
if self.runtime_handle.request_exit(RESTART_EXIT_CODE).is_err() {
self.cleanup_before_exit();
}

View File

@ -71,7 +71,7 @@ pub fn current_binary(_env: &Env) -> std::io::Result<PathBuf> {
/// Ok(())
/// });
/// ```
pub fn restart(env: &Env) {
pub fn restart(env: &Env) -> ! {
use std::process::{exit, Command};
if let Ok(path) = current_binary(env) {