Browse Source

tauri: comment out restart server dialog

Brendan Allan 2 months ago
parent
commit
e072f9605c
1 changed files with 24 additions and 23 deletions
  1. 24 23
      packages/tauri/src-tauri/src/lib.rs

+ 24 - 23
packages/tauri/src-tauri/src/lib.rs

@@ -108,29 +108,30 @@ pub fn run() {
 
             tauri::async_runtime::spawn(async move {
                 let port = get_sidecar_port();
-                let socket_connected = is_server_running(port).await;
-
-                let should_spawn_sidecar = if socket_connected {
-                    let res = app
-                        .dialog()
-                        .message(
-                            "OpenCode Server is already running, would you like to restart it?",
-                        )
-                        .buttons(MessageDialogButtons::YesNo)
-                        .blocking_show_with_result();
-
-                    match res {
-                        MessageDialogResult::Yes => {
-                            if let Err(e) = find_and_kill_process_on_port(port) {
-                                eprintln!("Failed to kill process on port {}: {}", port, e);
-                            }
-                            true
-                        }
-                        _ => false,
-                    }
-                } else {
-                    true
-                };
+
+                let should_spawn_sidecar = !is_server_running(port).await;
+
+                // if server_running {
+                //     let res = app
+                //         .dialog()
+                //         .message(
+                //             "OpenCode Server is already running, would you like to restart it?",
+                //         )
+                //         .buttons(MessageDialogButtons::YesNo)
+                //         .blocking_show_with_result();
+
+                //     match res {
+                //         MessageDialogResult::Yes => {
+                //             if let Err(e) = find_and_kill_process_on_port(port) {
+                //                 eprintln!("Failed to kill process on port {}: {}", port, e);
+                //             }
+                //             true
+                //         }
+                //         _ => false,
+                //     }
+                // } else {
+                //     true
+                // };
 
                 let child = if should_spawn_sidecar {
                     let child = spawn_sidecar(&app, port);