(params: KillParams)
| 280 | } |
| 281 | |
| 282 | async function handleKill(params: KillParams): Promise<{ ok: boolean }> { |
| 283 | logger.info("[Pty:kill] Killing PTY", JSON.stringify({ ptyId: params.ptyId })) |
| 284 | |
| 285 | const p = activePtys.get(params.ptyId) |
| 286 | if (!p) { |
| 287 | return { ok: false } |
| 288 | } |
| 289 | |
| 290 | try { |
| 291 | if (!p.exited) { |
| 292 | p.pty.kill() |
| 293 | } |
| 294 | |
| 295 | if (p.cleanupTimeoutId) { |
| 296 | clearTimeout(p.cleanupTimeoutId) |
| 297 | } |
| 298 | activePtys.delete(params.ptyId) |
| 299 | emitLifecycle({ type: "killed", ptyId: params.ptyId }) |
| 300 | |
| 301 | return { ok: true } |
| 302 | } catch (error) { |
| 303 | logger.error("[Pty:kill] Error:", error) |
| 304 | return { ok: false } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | export async function spawnRuntimePty(params: SpawnParams): Promise<SpawnResponse> { |
| 309 | return handleSpawn(params) |
no test coverage detected