Skip to content

Commit ba98b44

Browse files
authored
feat(task): cancel active background command during task abort (cline#7363)
Add cleanup logic to cancel any active background command when aborting a task. This ensures background processes are properly terminated before the task abort completes, preventing orphaned background commands.
1 parent fdeb639 commit ba98b44

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/core/task/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,14 @@ export class Task {
13581358
}
13591359
}
13601360

1361+
if (this.activeBackgroundCommand) {
1362+
try {
1363+
await this.cancelBackgroundCommand()
1364+
} catch (error) {
1365+
Logger.error("Failed to cancel background command during task abort", error)
1366+
}
1367+
}
1368+
13611369
// PHASE 4: Run TaskCancel hook
13621370
// This allows the hook UI to appear in the webview
13631371
// Use the shouldRunTaskCancelHook value we captured in Phase 1

0 commit comments

Comments
 (0)