feat: clean up all tasks before exit

This commit is contained in:
d-kimsuon
2025-09-03 03:44:43 +09:00
parent d9a0f17ce7
commit 31da82377d
3 changed files with 17 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import { execSync } from "node:child_process";
import { query } from "@anthropic-ai/claude-code";
import { ulid } from "ulid";
import prexit from "prexit";
import { type EventBus, getEventBus } from "../events/EventBus";
import { createMessageGenerator } from "./createMessageGenerator";
import type {
@@ -20,6 +21,12 @@ export class ClaudeCodeTaskController {
.toString()
.trim();
this.eventBus = getEventBus();
prexit(() => {
this.aliveTasks.forEach((task) => {
task.abortController.abort();
});
});
}
public get aliveTasks() {