mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-10-05 20:48:58 +03:00
feat(core): mark AppHandle::restart
and process::restart
as diverging functions (#10171)
closes #10160
This commit is contained in:
parent
eeae0660e1
commit
a7354f9a81
5
.changes/core-restart-fn-diverging.md
Normal file
5
.changes/core-restart-fn-diverging.md
Normal 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).
|
@ -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();
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user