From 89f9a50cea3dc7daa183b88d84f450bb8742f4de Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Fri, 27 Feb 2026 23:57:02 +0000 Subject: [PATCH] Fixed: Handle reader thread panics explicitly in blocking bash Replace unwrap_or_default() with explicit error handling that converts thread join failures (panics) to ToolError::Execution with context about which thread failed. Fixes: B008 --- src/llm-coding-tools-core/src/tools/bash/blocking_impl.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/llm-coding-tools-core/src/tools/bash/blocking_impl.rs b/src/llm-coding-tools-core/src/tools/bash/blocking_impl.rs index cae821e9..4cc58980 100644 --- a/src/llm-coding-tools-core/src/tools/bash/blocking_impl.rs +++ b/src/llm-coding-tools-core/src/tools/bash/blocking_impl.rs @@ -110,8 +110,12 @@ pub fn execute_command( }; // Join pipe-draining threads (they will complete once child exits or is killed) - let stdout_data = stdout_thread.join().unwrap_or_default(); - let stderr_data = stderr_thread.join().unwrap_or_default(); + let stdout_data = stdout_thread + .join() + .map_err(|_| ToolError::Execution("stdout reader thread panicked".to_string()))?; + let stderr_data = stderr_thread + .join() + .map_err(|_| ToolError::Execution("stderr reader thread panicked".to_string()))?; // Return result match exit_status {