MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / killTask

Function killTask

source code/tasks/LocalShellTask/killShellTasks.ts:18–48  ·  view source on GitHub ↗
(taskId: string, setAppState: SetAppStateFn)

Source from the content-addressed store, hash-verified

16type SetAppStateFn = (updater: (prev: AppState) => AppState) => void
17
18export function killTask(taskId: string, setAppState: SetAppStateFn): void {
19 updateTaskState(taskId, setAppState, task => {
20 if (task.status !== 'running' || !isLocalShellTask(task)) {
21 return task
22 }
23
24 try {
25 logForDebugging(`LocalShellTask ${taskId} kill requested`)
26 task.shellCommand?.kill()
27 task.shellCommand?.cleanup()
28 } catch (error) {
29 logError(error)
30 }
31
32 task.unregisterCleanup?.()
33 if (task.cleanupTimeoutId) {
34 clearTimeout(task.cleanupTimeoutId)
35 }
36
37 return {
38 ...task,
39 status: 'killed',
40 notified: true,
41 shellCommand: null,
42 unregisterCleanup: undefined,
43 cleanupTimeoutId: undefined,
44 endTime: Date.now(),
45 }
46 })
47 void evictTaskOutput(taskId)
48}
49
50/**
51 * Kill all running bash tasks spawned by a given agent.

Callers 4

killShellTasksForAgentFunction · 0.85
killFunction · 0.85
spawnShellTaskFunction · 0.85
registerForegroundFunction · 0.85

Calls 7

isLocalShellTaskFunction · 0.85
logForDebuggingFunction · 0.85
evictTaskOutputFunction · 0.85
updateTaskStateFunction · 0.50
logErrorFunction · 0.50
killMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected