fix: update /help test to expect botCommand dispatch, fix PTY fd leak in claude_code.rs (#451, #452)

The /help test expected the help overlay to appear, but /help now goes
through botCommand like other slash commands. Updated the test to match.

Also added reader thread join and child.wait() calls to
claude_code.rs to prevent PTY master fd leaks from web UI chat sessions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-03-31 14:48:47 +00:00
parent f16545ec36
commit dc4bac3a85
2 changed files with 15 additions and 4 deletions
+6 -1
View File
@@ -256,7 +256,7 @@ fn run_pty_session(
// Read NDJSON lines from stdout
let (line_tx, line_rx) = std::sync::mpsc::channel::<Option<String>>();
std::thread::spawn(move || {
let reader_handle = std::thread::spawn(move || {
let buf_reader = BufReader::new(reader);
slog!("[pty-debug] Reader thread started");
for line in buf_reader.lines() {
@@ -284,6 +284,8 @@ fn run_pty_session(
loop {
if cancelled.load(Ordering::Relaxed) {
let _ = child.kill();
let _ = child.wait();
let _ = reader_handle.join();
return Err("Cancelled".to_string());
}
@@ -365,8 +367,11 @@ fn run_pty_session(
}
// If still running after 2s, kill it
let _ = child.kill();
let _ = child.wait();
}
}
// Wait for the reader thread to release the cloned PTY master fd.
let _ = reader_handle.join();
Ok(())
}