fix(coding-agent): kill tracked detached bash children on shutdown
This commit is contained in:
@@ -70,6 +70,7 @@ import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/cha
|
||||
import { copyToClipboard } from "../../utils/clipboard.js";
|
||||
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
||||
import { parseGitUrl } from "../../utils/git.js";
|
||||
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
||||
import { ensureTool } from "../../utils/tools-manager.js";
|
||||
import { ArminComponent } from "./components/armin.js";
|
||||
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
||||
@@ -2941,6 +2942,7 @@ export class InteractiveMode {
|
||||
|
||||
for (const signal of signals) {
|
||||
const handler = () => {
|
||||
killTrackedDetachedChildren();
|
||||
void this.shutdown();
|
||||
};
|
||||
process.on(signal, handler);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import type { AssistantMessage, ImageContent } from "@mariozechner/pi-ai";
|
||||
import type { AgentSessionRuntime } from "../core/agent-session-runtime.js";
|
||||
import { flushRawStdout, writeRawStdout } from "../core/output-guard.js";
|
||||
import { killTrackedDetachedChildren } from "../utils/shell.js";
|
||||
|
||||
/**
|
||||
* Options for print mode.
|
||||
@@ -51,6 +52,7 @@ export async function runPrintMode(runtimeHost: AgentSessionRuntime, options: Pr
|
||||
|
||||
for (const signal of signals) {
|
||||
const handler = () => {
|
||||
killTrackedDetachedChildren();
|
||||
void disposeRuntime().finally(() => {
|
||||
process.exit(signal === "SIGHUP" ? 129 : 143);
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ import type {
|
||||
ExtensionWidgetOptions,
|
||||
} from "../../core/extensions/index.js";
|
||||
import { takeOverStdout, writeRawStdout } from "../../core/output-guard.js";
|
||||
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
||||
import { type Theme, theme } from "../interactive/theme/theme.js";
|
||||
import { attachJsonlLineReader, serializeJsonLine } from "./jsonl.js";
|
||||
import type {
|
||||
@@ -346,6 +347,7 @@ export async function runRpcMode(runtimeHost: AgentSessionRuntime): Promise<neve
|
||||
|
||||
for (const signal of signals) {
|
||||
const handler = () => {
|
||||
killTrackedDetachedChildren();
|
||||
void shutdown(signal === "SIGHUP" ? 129 : 143);
|
||||
};
|
||||
process.on(signal, handler);
|
||||
|
||||
Reference in New Issue
Block a user