fix: PTY crash — use std:🧵:spawn instead of tokio::spawn_blocking
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 2m49s
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 2m49s
tokio::task::spawn_blocking panics when called without a tokio runtime
context. Sync Tauri command handlers may not have one. The PTY reader
loop is long-lived anyway — std:🧵:spawn is more correct for
persistent blocking I/O and doesn't require a runtime guard.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
512347af5f
commit
37c9b46a51
@ -112,11 +112,13 @@ impl PtyService {
|
|||||||
|
|
||||||
self.sessions.insert(session_id.clone(), session);
|
self.sessions.insert(session_id.clone(), session);
|
||||||
|
|
||||||
// Output reader loop — runs in a blocking thread because
|
// Output reader loop — runs in a dedicated OS thread because
|
||||||
// portable-pty's reader is synchronous (std::io::Read).
|
// 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 sid = session_id.clone();
|
||||||
let app = app_handle;
|
let app = app_handle;
|
||||||
tokio::task::spawn_blocking(move || {
|
std::thread::spawn(move || {
|
||||||
let mut reader = std::io::BufReader::new(reader);
|
let mut reader = std::io::BufReader::new(reader);
|
||||||
let mut buf = [0u8; 4096];
|
let mut buf = [0u8; 4096];
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user