From bdf7b15bd7cbe7a13cece9dfc6d81e4d795e35ef Mon Sep 17 00:00:00 2001 From: huqiantao Date: Sun, 7 Jun 2026 19:59:17 +0800 Subject: [PATCH] revert: use std::thread::spawn for fire-and-forget hooks tokio::task::spawn_blocking requires a running tokio runtime, which breaks tests that call hook functions outside a tokio context. Since hooks are fire-and-forget (no JoinHandle needed), std::thread::spawn is the correct choice. --- crates/tui/src/hooks.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tui/src/hooks.rs b/crates/tui/src/hooks.rs index f0421e3d..e9769883 100644 --- a/crates/tui/src/hooks.rs +++ b/crates/tui/src/hooks.rs @@ -1051,8 +1051,8 @@ impl HookExecutor { let env = env_vars.clone(); let wd = working_dir.clone(); - // Spawn in a blocking task (respects tokio's thread pool limits). - tokio::task::spawn_blocking(move || { + // Spawn in a detached thread (fire-and-forget hook execution). + std::thread::spawn(move || { let mut command = HookExecutor::build_shell_command(&cmd); command .current_dir(&wd)