feat: 优化 Nitro sidecar 进程启动与监控逻辑
- 引入必要的同步与时间处理模块,优化 Nitro sidecar 进程的启动与监控逻辑,确保服务器就绪后正确创建主窗口并处理启动超时和失败情况。
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -1,8 +1,8 @@
|
|||||||
use tauri::Manager;
|
|
||||||
use tauri_plugin_shell::ShellExt;
|
|
||||||
use tauri_plugin_shell::process::{CommandEvent, CommandChild};
|
|
||||||
use std::time::Duration;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
use std::time::Duration;
|
||||||
|
use tauri::Manager;
|
||||||
|
use tauri_plugin_shell::process::{CommandChild, CommandEvent};
|
||||||
|
use tauri_plugin_shell::ShellExt;
|
||||||
|
|
||||||
// 全局状态:存储 Nitro 进程句柄
|
// 全局状态:存储 Nitro 进程句柄
|
||||||
struct NitroProcess(Mutex<Option<CommandChild>>);
|
struct NitroProcess(Mutex<Option<CommandChild>>);
|
||||||
@@ -81,7 +81,7 @@ pub fn run() {
|
|||||||
tauri::WebviewWindowBuilder::new(
|
tauri::WebviewWindowBuilder::new(
|
||||||
&app_handle,
|
&app_handle,
|
||||||
"main",
|
"main",
|
||||||
tauri::WebviewUrl::External(url.parse().unwrap())
|
tauri::WebviewUrl::External(url.parse().unwrap()),
|
||||||
)
|
)
|
||||||
.title("Nitro Application")
|
.title("Nitro Application")
|
||||||
.inner_size(1200.0, 800.0)
|
.inner_size(1200.0, 800.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user