@@ -5,7 +5,8 @@ use tauri_plugin_dialog::{
55 DialogExt , MessageDialogBuilder , MessageDialogButtons , MessageDialogKind ,
66} ;
77use tauri_plugin_log:: { Target , TargetKind } ;
8- use tauri_plugin_shell:: { process:: CommandChild , ShellExt } ;
8+ use tauri_plugin_shell:: process:: CommandChild ;
9+ use tauri_plugin_shell:: ShellExt ;
910
1011const GPTME_SERVER_PORT : u16 = 5700 ;
1112
@@ -43,9 +44,9 @@ pub fn run() {
4344
4445 let app_handle = app. handle ( ) . clone ( ) ;
4546
46- // Store child process reference for cleanup
47- let child_process : Arc < Mutex < Option < CommandChild > > > = Arc :: new ( Mutex :: new ( None ) ) ;
48- let child_for_cleanup = child_process . clone ( ) ;
47+ // Store child process PID for cleanup
48+ let child_pid : Arc < Mutex < Option < u32 > > > = Arc :: new ( Mutex :: new ( None ) ) ;
49+ let child_pid_for_cleanup = child_pid . clone ( ) ;
4950
5051 // Spawn gptme-server with output capture
5152 tauri:: async_runtime:: spawn ( async move {
@@ -101,9 +102,9 @@ pub fn run() {
101102 child. pid( )
102103 ) ;
103104
104- // Store child process reference
105- if let Ok ( mut child_ref ) = child_process . lock ( ) {
106- * child_ref = Some ( child) ;
105+ // Store child process PID
106+ if let Ok ( mut pid_ref ) = child_pid . lock ( ) {
107+ * pid_ref = Some ( child. pid ( ) ) ;
107108 }
108109
109110 // Handle server output
@@ -149,8 +150,8 @@ pub fn run() {
149150 }
150151 } ) ;
151152
152- // Store child process reference in app state for cleanup
153- app. manage ( child_for_cleanup ) ;
153+ // Store child process PID in app state for cleanup
154+ app. manage ( child_pid_for_cleanup ) ;
154155
155156 Ok ( ( ) )
156157 } )
0 commit comments