diff --git a/.changeset/bright-apples-protect.md b/.changeset/bright-apples-protect.md new file mode 100644 index 00000000..55111778 --- /dev/null +++ b/.changeset/bright-apples-protect.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Detect Ctrl+C termination of terminal activity on long running commands diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index 6d4587d2..0528503d 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -94,6 +94,15 @@ export class TerminalProcess extends EventEmitter { data = stripAnsi(data) } + // Ctrl+C detection: if user presses Ctrl+C, treat as command terminated + if (data.includes("^C") || data.includes("\u0003")) { + if (this.hotTimer) { + clearTimeout(this.hotTimer) + } + this.isHot = false + break + } + // first few chunks could be the command being echoed back, so we must ignore // note this means that 'echo' commands won't work if (!didOutputNonCommand) {