feat: add interrupt button

This commit is contained in:
2026-01-19 22:25:06 -08:00
parent 70fcaa8650
commit a8774d0c87
8 changed files with 231 additions and 18 deletions
+24
View File
@@ -332,6 +332,30 @@ impl WslBridge {
Ok(())
}
pub fn interrupt(&mut self, app: &AppHandle) -> Result<(), String> {
// Due to persistent bug in Claude Code where ESC/Ctrl+C doesn't work,
// we have to kill the process. This is the only reliable way to stop it.
// See: https://github.com/anthropics/claude-code/issues/3455
if let Some(mut process) = self.process.take() {
// Kill the process immediately
let _ = process.kill();
let _ = process.wait();
// Clear stdin
self.stdin = None;
// Keep session_id and working directory for user reference
// The user will see what session was interrupted
// Emit disconnected status
emit_connection_status(app, ConnectionStatus::Disconnected);
Ok(())
} else {
Err("No active process to interrupt".to_string())
}
}
pub fn stop(&mut self, app: &AppHandle) {
if let Some(mut process) = self.process.take() {
let _ = process.kill();