Skip to content

Commit 022fdf4

Browse files
authored
ENG-501/Detection of command termination using Ctrl+C (RooCodeInc#2960)
* Detect Ctrl C input when users terminal a long running terminal command * Remove terminal-output-truncation.md documentation file
1 parent fb3105f commit 022fdf4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Detect Ctrl+C termination of terminal activity on long running commands

src/integrations/terminal/TerminalProcess.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
9494
data = stripAnsi(data)
9595
}
9696

97+
// Ctrl+C detection: if user presses Ctrl+C, treat as command terminated
98+
if (data.includes("^C") || data.includes("\u0003")) {
99+
if (this.hotTimer) {
100+
clearTimeout(this.hotTimer)
101+
}
102+
this.isHot = false
103+
break
104+
}
105+
97106
// first few chunks could be the command being echoed back, so we must ignore
98107
// note this means that 'echo' commands won't work
99108
if (!didOutputNonCommand) {

0 commit comments

Comments
 (0)