diff --git a/src-tauri/src/pty/mod.rs b/src-tauri/src/pty/mod.rs index 5ca6a61..6034f83 100644 --- a/src-tauri/src/pty/mod.rs +++ b/src-tauri/src/pty/mod.rs @@ -112,11 +112,13 @@ impl PtyService { self.sessions.insert(session_id.clone(), session); - // Output reader loop — runs in a blocking thread because - // portable-pty's reader is synchronous (std::io::Read). + // Output reader loop — runs in a dedicated OS thread because + // portable-pty's reader is synchronous (std::io::Read) and + // long-lived. Using std::thread::spawn avoids requiring a + // tokio runtime context (sync Tauri commands may not have one). let sid = session_id.clone(); let app = app_handle; - tokio::task::spawn_blocking(move || { + std::thread::spawn(move || { let mut reader = std::io::BufReader::new(reader); let mut buf = [0u8; 4096]; loop {