@botiverse/oar 0.80.0 → 0.80.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/records.d.ts +2 -2
- package/dist/contracts/records.d.ts.map +1 -1
- package/dist/runtimes/claude/context-breakdown.js +2 -2
- package/dist/runtimes/claude/context-breakdown.js.map +1 -1
- package/dist/runtimes/qoder/daemon.d.ts.map +1 -1
- package/dist/runtimes/qoder/daemon.js +3 -1
- package/dist/runtimes/qoder/daemon.js.map +1 -1
- package/dist/runtimes/qoder/launch.d.ts.map +1 -1
- package/dist/runtimes/qoder/launch.js +1 -0
- package/dist/runtimes/qoder/launch.js.map +1 -1
- package/dist/runtimes/qwen/close.d.ts.map +1 -1
- package/dist/runtimes/qwen/close.js +1 -0
- package/dist/runtimes/qwen/close.js.map +1 -1
- package/dist/shared/acp/input.d.ts +8 -0
- package/dist/shared/acp/input.d.ts.map +1 -0
- package/dist/shared/acp/input.js +76 -0
- package/dist/shared/acp/input.js.map +1 -0
- package/dist/shared/acp/process.d.ts +4 -0
- package/dist/shared/acp/process.d.ts.map +1 -1
- package/dist/shared/acp/process.js +21 -2
- package/dist/shared/acp/process.js.map +1 -1
- package/dist/shared/acp/session.d.ts.map +1 -1
- package/dist/shared/acp/session.js +7 -0
- package/dist/shared/acp/session.js.map +1 -1
- package/dist/shared/executable/ownership.d.ts +4 -0
- package/dist/shared/executable/ownership.d.ts.map +1 -1
- package/dist/shared/executable/ownership.js +35 -13
- package/dist/shared/executable/ownership.js.map +1 -1
- package/dist/shared/executable/process-cleanup-diagnostics.d.ts +21 -0
- package/dist/shared/executable/process-cleanup-diagnostics.d.ts.map +1 -0
- package/dist/shared/executable/process-cleanup-diagnostics.js +22 -0
- package/dist/shared/executable/process-cleanup-diagnostics.js.map +1 -0
- package/dist/shared/executable/process-cleanup.d.ts +8 -24
- package/dist/shared/executable/process-cleanup.d.ts.map +1 -1
- package/dist/shared/executable/process-cleanup.js +81 -44
- package/dist/shared/executable/process-cleanup.js.map +1 -1
- package/dist/shared/executable/process-shutdown.d.ts +19 -0
- package/dist/shared/executable/process-shutdown.d.ts.map +1 -0
- package/dist/shared/executable/process-shutdown.js +148 -0
- package/dist/shared/executable/process-shutdown.js.map +1 -0
- package/dist/shared/executable/process-signals.d.ts +43 -0
- package/dist/shared/executable/process-signals.d.ts.map +1 -0
- package/dist/shared/executable/process-signals.js +74 -0
- package/dist/shared/executable/process-signals.js.map +1 -0
- package/dist/shared/executable/process-table-async.d.ts +10 -0
- package/dist/shared/executable/process-table-async.d.ts.map +1 -0
- package/dist/shared/executable/process-table-async.js +104 -0
- package/dist/shared/executable/process-table-async.js.map +1 -0
- package/dist/shared/executable/process-table-command.d.ts +4 -0
- package/dist/shared/executable/process-table-command.d.ts.map +1 -0
- package/dist/shared/executable/process-table-command.js +69 -0
- package/dist/shared/executable/process-table-command.js.map +1 -0
- package/dist/shared/executable/process-tree.d.ts +15 -4
- package/dist/shared/executable/process-tree.d.ts.map +1 -1
- package/dist/shared/executable/process-tree.js +49 -31
- package/dist/shared/executable/process-tree.js.map +1 -1
- package/dist/shared/executable/process.d.ts +13 -46
- package/dist/shared/executable/process.d.ts.map +1 -1
- package/dist/shared/executable/process.js +29 -139
- package/dist/shared/executable/process.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.js","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EAAmD,MAAM,mBAAmB,CAAC;AACrI,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ownership.js","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAA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AAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProcessTableObservation } from "./process-tree.js";
|
|
2
|
+
export type Phase = "before_eof" | "before_force" | "after_exit";
|
|
3
|
+
export type Observation = (Exclude<ProcessTableObservation, {
|
|
4
|
+
ok: true;
|
|
5
|
+
}> | {
|
|
6
|
+
readonly ok: true;
|
|
7
|
+
readonly source: ProcessTableObservation["source"];
|
|
8
|
+
readonly elapsedMs: number;
|
|
9
|
+
readonly skipped: number;
|
|
10
|
+
}) & {
|
|
11
|
+
readonly phase: Phase;
|
|
12
|
+
};
|
|
13
|
+
/** Internal observations, not a guarantee that every descendant has exited. */
|
|
14
|
+
export interface ProcessCleanupDiagnostics {
|
|
15
|
+
readonly status: "observed" | "unverified";
|
|
16
|
+
readonly observations: readonly Observation[];
|
|
17
|
+
}
|
|
18
|
+
export declare function cleanupFailureReason(cleanup: ProcessCleanupDiagnostics | undefined): string | undefined;
|
|
19
|
+
/** Keep a startup error's native class, code and cause when cleanup also failed. */
|
|
20
|
+
export declare function appendCleanupFailure(error: unknown, reason: string | undefined): unknown;
|
|
21
|
+
//# sourceMappingURL=process-cleanup-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-cleanup-diagnostics.d.ts","sources":["../../../src/shared/executable/process-cleanup-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;AACjE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG;IAC1E,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAE/B,+EAA+E;AAC/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKvG;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAQxF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function cleanupFailureReason(cleanup) {
|
|
2
|
+
if (cleanup?.status !== "unverified") {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
const reasons = cleanup.observations.filter((entry) => !entry.ok).map((entry) => `${entry.phase} ${entry.source}: ${entry.reason} (${entry.elapsedMs.toFixed(0)} ms${entry.code === undefined ? "" : `, ${entry.code}`}${entry.exitCode === undefined ? "" : `, exit ${String(entry.exitCode)}`}${entry.signal === undefined ? "" : `, ${entry.signal}`})`);
|
|
6
|
+
return `Descendant cleanup could not be verified: ${reasons.join("; ")}`;
|
|
7
|
+
}
|
|
8
|
+
/** Keep a startup error's native class, code and cause when cleanup also failed. */
|
|
9
|
+
export function appendCleanupFailure(error, reason) {
|
|
10
|
+
if (reason === undefined) {
|
|
11
|
+
return error;
|
|
12
|
+
}
|
|
13
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
14
|
+
if (!failure.message.includes(reason)) {
|
|
15
|
+
failure.message += `; ${reason}`;
|
|
16
|
+
if (failure.stack !== undefined) {
|
|
17
|
+
failure.stack += `\nCleanup: ${reason}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return failure;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=process-cleanup-diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-cleanup-diagnostics.js","sources":["../../../src/shared/executable/process-cleanup-diagnostics.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,oBAAoB,CAAC,OAA8C;IACjF,IAAI,OAAO,EAAE,MAAM,KAAK,YAAY,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9E,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7Q,OAAO,6CAA6C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,oBAAoB,CAAC,KAAc,EAAE,MAA0B;IAC7E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,OAAO,IAAI,KAAK,MAAM,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAAC,OAAO,CAAC,KAAK,IAAI,cAAc,MAAM,EAAE,CAAC;QAAC,CAAC;IAC/E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import { type ProcessTableObservation } from "./process-tree.js";
|
|
2
|
-
type Phase
|
|
3
|
-
|
|
4
|
-
ok: true;
|
|
5
|
-
}> | {
|
|
6
|
-
readonly ok: true;
|
|
7
|
-
readonly source: ProcessTableObservation["source"];
|
|
8
|
-
readonly elapsedMs: number;
|
|
9
|
-
readonly skipped: number;
|
|
10
|
-
}) & {
|
|
11
|
-
readonly phase: Phase;
|
|
12
|
-
};
|
|
13
|
-
/** Internal observations, not a guarantee that every descendant has exited. */
|
|
14
|
-
export interface ProcessCleanupDiagnostics {
|
|
15
|
-
readonly status: "observed" | "unverified";
|
|
16
|
-
readonly observations: readonly Observation[];
|
|
17
|
-
}
|
|
18
|
-
export declare function cleanupFailureReason(cleanup: ProcessCleanupDiagnostics | undefined): string | undefined;
|
|
19
|
-
/** Keep a startup error's native class, code and cause when cleanup also failed. */
|
|
20
|
-
export declare function appendCleanupFailure(error: unknown, reason: string | undefined): unknown;
|
|
2
|
+
import type { Phase, ProcessCleanupDiagnostics } from "./process-cleanup-diagnostics.js";
|
|
3
|
+
export { appendCleanupFailure, cleanupFailureReason, type ProcessCleanupDiagnostics } from "./process-cleanup-diagnostics.js";
|
|
21
4
|
/** Capture before EOF, then revalidate identities before signalling descendants. */
|
|
22
|
-
export declare function processTreeCleanup(pid: number): {
|
|
23
|
-
capture(): void
|
|
24
|
-
force(stopRoot: () => void): void
|
|
25
|
-
finish(): void
|
|
5
|
+
export declare function processTreeCleanup(pid: number, alive?: () => boolean): {
|
|
6
|
+
capture(): Promise<void>;
|
|
7
|
+
force(stopRoot: () => void): Promise<void>;
|
|
8
|
+
finish(): Promise<void>;
|
|
9
|
+
finishSync(read: () => ProcessTableObservation): ProcessCleanupDiagnostics;
|
|
10
|
+
failed(error: unknown, phase: Phase): void;
|
|
26
11
|
diagnostics(): ProcessCleanupDiagnostics;
|
|
27
12
|
};
|
|
28
|
-
export {};
|
|
29
13
|
//# sourceMappingURL=process-cleanup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-cleanup.d.ts","sources":["../../../src/shared/executable/process-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyF,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"process-cleanup.d.ts","sources":["../../../src/shared/executable/process-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyF,KAAK,uBAAuB,EAA2B,MAAM,mBAAmB,CAAC;AAEjL,OAAO,KAAK,EAAe,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAEtG,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAI9H,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,OAAoB,GAAG;IAClF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,UAAU,CAAC,IAAI,EAAE,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;IAC3E,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC3C,WAAW,IAAI,yBAAyB,CAAC;CAC1C,CAkFA"}
|
|
@@ -1,84 +1,121 @@
|
|
|
1
|
-
import { descendantsOf, killEntries,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return undefined;
|
|
5
|
-
}
|
|
6
|
-
const reasons = cleanup.observations.filter((entry) => !entry.ok).map((entry) => `${entry.phase} ${entry.source}: ${entry.reason} (${entry.elapsedMs.toFixed(0)} ms${entry.code === undefined ? "" : `, ${entry.code}`}${entry.exitCode === undefined ? "" : `, exit ${String(entry.exitCode)}`}${entry.signal === undefined ? "" : `, ${entry.signal}`})`);
|
|
7
|
-
return `Descendant cleanup could not be verified: ${reasons.join("; ")}`;
|
|
8
|
-
}
|
|
9
|
-
/** Keep a startup error's native class, code and cause when cleanup also failed. */
|
|
10
|
-
export function appendCleanupFailure(error, reason) {
|
|
11
|
-
if (reason === undefined) {
|
|
12
|
-
return error;
|
|
13
|
-
}
|
|
14
|
-
const failure = error instanceof Error ? error : new Error(String(error));
|
|
15
|
-
if (!failure.message.includes(reason)) {
|
|
16
|
-
failure.message += `; ${reason}`;
|
|
17
|
-
if (failure.stack !== undefined) {
|
|
18
|
-
failure.stack += `\nCleanup: ${reason}`;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return failure;
|
|
22
|
-
}
|
|
1
|
+
import { descendantsOf, killEntries, processTableFailure } from "./process-tree.js";
|
|
2
|
+
import { observeProcessTableAsync, processTableSource } from "./process-table-async.js";
|
|
3
|
+
export { appendCleanupFailure, cleanupFailureReason } from "./process-cleanup-diagnostics.js";
|
|
23
4
|
/** Capture before EOF, then revalidate identities before signalling descendants. */
|
|
24
|
-
export function processTreeCleanup(pid) {
|
|
5
|
+
export function processTreeCleanup(pid, alive = () => true) {
|
|
25
6
|
const observations = [];
|
|
26
7
|
let unverified = false;
|
|
8
|
+
let captured = false;
|
|
27
9
|
let descendants = [];
|
|
28
10
|
let root = undefined;
|
|
29
|
-
const
|
|
30
|
-
|
|
11
|
+
const diagnostics = () => ({ status: unverified ? "unverified" : "observed", observations: [...observations] });
|
|
12
|
+
const failed = (error, phase) => {
|
|
13
|
+
unverified = true;
|
|
14
|
+
observations.push({ ...processTableFailure(error, processTableSource(), 0), phase });
|
|
15
|
+
};
|
|
16
|
+
const accept = (result, phase) => {
|
|
31
17
|
if (!result.ok) {
|
|
32
18
|
observations.push({ ...result, phase });
|
|
33
19
|
return undefined;
|
|
34
20
|
}
|
|
35
|
-
if (phase === "before_eof" && !result.table.has(pid)) {
|
|
21
|
+
if (phase === "before_eof" && (!alive() || !result.table.has(pid))) {
|
|
36
22
|
observations.push({ ok: false, phase, source: result.source, elapsedMs: result.elapsedMs, reason: "missing_root" });
|
|
37
23
|
return undefined;
|
|
38
24
|
}
|
|
39
25
|
observations.push({ ok: true, phase, source: result.source, elapsedMs: result.elapsedMs, skipped: result.skipped });
|
|
40
|
-
return result.table;
|
|
26
|
+
return { table: result.table, source: result.source };
|
|
27
|
+
};
|
|
28
|
+
const read = async (phase) => {
|
|
29
|
+
try {
|
|
30
|
+
return accept(await observeProcessTableAsync(), phase);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
failed(error, phase);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const ownedEntries = ({ table, source }, includeLiveRoot = false) => {
|
|
38
|
+
const entries = new Map();
|
|
39
|
+
const currentRoot = table.get(pid);
|
|
40
|
+
const roots = [...descendants];
|
|
41
|
+
if (currentRoot !== undefined && (root === undefined ? includeLiveRoot && alive() : currentRoot.start === root.start)) {
|
|
42
|
+
roots.push(currentRoot);
|
|
43
|
+
}
|
|
44
|
+
for (const entry of roots) {
|
|
45
|
+
if (table.get(entry.pid)?.start !== entry.start) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
// Only the owned root's caller may stop the root itself. Captured tools
|
|
49
|
+
// can acquire new children after capture, even after root exit.
|
|
50
|
+
if (entry.pid !== pid) {
|
|
51
|
+
entries.set(entry.pid, entry);
|
|
52
|
+
}
|
|
53
|
+
for (const child of descendantsOf(table, entry.pid, source)) {
|
|
54
|
+
entries.set(child.pid, child);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return [...entries.values()];
|
|
41
58
|
};
|
|
42
59
|
return {
|
|
43
|
-
capture() {
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
60
|
+
async capture() {
|
|
61
|
+
// At most two reads (one retry), both before EOF. A root that exited
|
|
62
|
+
// during a read cannot lend its possibly reused PID to a retry.
|
|
63
|
+
let table = await read("before_eof");
|
|
64
|
+
if (table === undefined && alive()) {
|
|
65
|
+
table = await read("before_eof");
|
|
66
|
+
}
|
|
47
67
|
if (table === undefined) {
|
|
48
68
|
unverified = true;
|
|
49
69
|
return;
|
|
50
70
|
}
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
captured = true;
|
|
72
|
+
root = table.table.get(pid);
|
|
73
|
+
descendants = descendantsOf(table.table, pid, table.source);
|
|
53
74
|
},
|
|
54
|
-
force(stopRoot) {
|
|
55
|
-
const table = read("before_force");
|
|
56
|
-
//
|
|
57
|
-
//
|
|
75
|
+
async force(stopRoot) {
|
|
76
|
+
const table = await read("before_force");
|
|
77
|
+
// Read failure still permits stopping the live owned root, but never
|
|
78
|
+
// signalling a remembered descendant without matching its identity.
|
|
58
79
|
stopRoot();
|
|
59
80
|
if (table === undefined) {
|
|
60
81
|
unverified = true;
|
|
61
82
|
return;
|
|
62
83
|
}
|
|
63
|
-
|
|
64
|
-
const now = root !== undefined && current?.start === root.start ? descendantsOf(table, pid) : [];
|
|
65
|
-
killEntries([...descendants, ...now], table);
|
|
84
|
+
killEntries(ownedEntries(table), table.table);
|
|
66
85
|
descendants = [];
|
|
67
86
|
},
|
|
68
|
-
finish() {
|
|
87
|
+
async finish() {
|
|
69
88
|
if (descendants.length === 0) {
|
|
70
89
|
return;
|
|
71
90
|
}
|
|
72
|
-
const table = read("after_exit");
|
|
91
|
+
const table = await read("after_exit");
|
|
73
92
|
if (table === undefined) {
|
|
74
93
|
unverified = true;
|
|
75
94
|
}
|
|
76
95
|
else {
|
|
77
|
-
killEntries(
|
|
96
|
+
killEntries(ownedEntries(table), table.table);
|
|
97
|
+
}
|
|
98
|
+
descendants = [];
|
|
99
|
+
},
|
|
100
|
+
finishSync(readNow) {
|
|
101
|
+
// The host may exit after child.close while an async observation is
|
|
102
|
+
// pending. Revalidate known identities synchronously, never its cache.
|
|
103
|
+
const phase = alive() ? "before_force" : "after_exit";
|
|
104
|
+
const table = accept(readNow(), phase);
|
|
105
|
+
if (table === undefined) {
|
|
106
|
+
unverified = true;
|
|
107
|
+
return diagnostics();
|
|
108
|
+
}
|
|
109
|
+
if (!captured && !alive()) {
|
|
110
|
+
unverified = true;
|
|
111
|
+
observations.push({ ok: false, phase: "before_eof", source: processTableSource(), elapsedMs: 0, reason: "missing_root" });
|
|
78
112
|
}
|
|
113
|
+
killEntries(ownedEntries(table, true), table.table);
|
|
79
114
|
descendants = [];
|
|
115
|
+
return diagnostics();
|
|
80
116
|
},
|
|
81
|
-
|
|
117
|
+
failed,
|
|
118
|
+
diagnostics,
|
|
82
119
|
};
|
|
83
120
|
}
|
|
84
121
|
//# sourceMappingURL=process-cleanup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-cleanup.js","sources":["../../../src/shared/executable/process-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"process-cleanup.js","sources":["../../../src/shared/executable/process-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO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,EAAE,EAAE,CAAC;gBAC1B,UAAU,GAAG,IAAI,CAAC;gBAClB,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;YAC5H,CAAC;YACD,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YACpD,WAAW,GAAG,EAAE,CAAC;YACjB,OAAO,WAAW,EAAE,CAAC;QACvB,CAAC;QACD,MAAM;QACN,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
import { type ProcessCleanupDiagnostics } from "./process-cleanup.js";
|
|
3
|
+
interface ShutdownOptions {
|
|
4
|
+
readonly killTree?: boolean;
|
|
5
|
+
readonly shutdown?: "stdin";
|
|
6
|
+
}
|
|
7
|
+
/** The root's exit and asynchronous cleanup form one owned, awaited lifetime. */
|
|
8
|
+
export declare function processShutdown(child: ChildProcess, options: ShutdownOptions): {
|
|
9
|
+
readonly finished: Promise<void>;
|
|
10
|
+
stop(): void;
|
|
11
|
+
prepare(): Promise<void>;
|
|
12
|
+
markNativeStop(): void;
|
|
13
|
+
nativeExited(): void;
|
|
14
|
+
stopping(): boolean;
|
|
15
|
+
diagnostics(): ProcessCleanupDiagnostics | undefined;
|
|
16
|
+
reason(): string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=process-shutdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-shutdown.d.ts","sources":["../../../src/shared/executable/process-shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAA4C,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAIhH,UAAU,eAAe;IAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAAE;AAEvF,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG;IAC9E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,cAAc,IAAI,IAAI,CAAC;IACvB,YAAY,IAAI,IAAI,CAAC;IACrB,QAAQ,IAAI,OAAO,CAAC;IACpB,WAAW,IAAI,yBAAyB,GAAG,SAAS,CAAC;IACrD,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC;CAC9B,CA+FA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { processTreeCleanup, cleanupFailureReason } from "./process-cleanup.js";
|
|
2
|
+
import { trackPendingCleanup } from "./ownership.js";
|
|
3
|
+
import { killGraceMs, killProcessTree, signalProcessGroup } from "./process-signals.js";
|
|
4
|
+
/** The root's exit and asynchronous cleanup form one owned, awaited lifetime. */
|
|
5
|
+
export function processShutdown(child, options) {
|
|
6
|
+
let stopping = false;
|
|
7
|
+
let ended = false;
|
|
8
|
+
let stopAction = false;
|
|
9
|
+
let phase = Promise.resolve();
|
|
10
|
+
let escalation = undefined;
|
|
11
|
+
let cleanup = undefined;
|
|
12
|
+
let capture = undefined;
|
|
13
|
+
let releaseCleanup = undefined;
|
|
14
|
+
const nativeExit = Promise.withResolvers();
|
|
15
|
+
const alive = () => !ended && child.exitCode === null && child.signalCode === null;
|
|
16
|
+
const stopRoot = () => {
|
|
17
|
+
if (!alive()) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
stopAction = true;
|
|
21
|
+
if (process.platform === "win32" && options.killTree === true) {
|
|
22
|
+
killProcessTree(child);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
signalProcessGroup(child, "SIGKILL");
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const force = async () => {
|
|
29
|
+
try {
|
|
30
|
+
if (cleanup === undefined) {
|
|
31
|
+
stopRoot();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
await cleanup.force(stopRoot);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
cleanup?.failed(error, "before_force");
|
|
39
|
+
if (alive()) {
|
|
40
|
+
try {
|
|
41
|
+
child.kill("SIGKILL");
|
|
42
|
+
}
|
|
43
|
+
catch { /* Native exit stays authoritative. */ }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const close = () => {
|
|
48
|
+
if (!alive()) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
stopAction = true;
|
|
52
|
+
child.stdin?.end();
|
|
53
|
+
// Pi reenters shutdown on EOF plus SIGTERM and skips its native hooks.
|
|
54
|
+
if (options.shutdown !== "stdin") {
|
|
55
|
+
if (process.platform === "win32" && options.killTree === true) {
|
|
56
|
+
killProcessTree(child);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
signalProcessGroup(child, "SIGTERM");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
escalation = setTimeout(() => { phase = force(); }, killGraceMs());
|
|
63
|
+
};
|
|
64
|
+
// Only call immediately before an intended stop: the snapshot is memoized
|
|
65
|
+
// and its cleanup stays registered until exit, even before stop() is called.
|
|
66
|
+
const prepare = async () => {
|
|
67
|
+
if (capture !== undefined) {
|
|
68
|
+
await capture;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!alive() || options.killTree !== true || child.pid === undefined) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const ownedCleanup = processTreeCleanup(child.pid, alive);
|
|
75
|
+
cleanup = ownedCleanup;
|
|
76
|
+
releaseCleanup = trackPendingCleanup((read) => ownedCleanup.finishSync(read));
|
|
77
|
+
capture = (async () => {
|
|
78
|
+
try {
|
|
79
|
+
await ownedCleanup.capture();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
ownedCleanup.failed(error, "before_eof");
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
phase = capture;
|
|
86
|
+
await capture;
|
|
87
|
+
};
|
|
88
|
+
const captureAndClose = async (prepared) => {
|
|
89
|
+
await prepared;
|
|
90
|
+
try {
|
|
91
|
+
close();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
cleanup?.failed(error, "before_force");
|
|
95
|
+
await force();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const finish = async () => {
|
|
99
|
+
await nativeExit.promise;
|
|
100
|
+
// Native exit can arrive during capture or force. Finish after that phase,
|
|
101
|
+
// not concurrently with a mutation of the remembered identity set.
|
|
102
|
+
await phase;
|
|
103
|
+
try {
|
|
104
|
+
await cleanup?.finish();
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
cleanup?.failed(error, "after_exit");
|
|
108
|
+
}
|
|
109
|
+
releaseCleanup?.();
|
|
110
|
+
};
|
|
111
|
+
const finished = finish();
|
|
112
|
+
return {
|
|
113
|
+
finished,
|
|
114
|
+
prepare,
|
|
115
|
+
markNativeStop() { if (alive()) {
|
|
116
|
+
stopAction = true;
|
|
117
|
+
} },
|
|
118
|
+
stopping: () => stopping,
|
|
119
|
+
diagnostics: () => cleanup?.diagnostics(),
|
|
120
|
+
reason: () => cleanupFailureReason(cleanup?.diagnostics()),
|
|
121
|
+
nativeExited() {
|
|
122
|
+
ended = true;
|
|
123
|
+
clearTimeout(escalation);
|
|
124
|
+
if (!stopAction) {
|
|
125
|
+
// A pending observation does not turn a spontaneous exit into an OAR
|
|
126
|
+
// stop. Its orphan descendants remain the natural-exit limitation.
|
|
127
|
+
cleanup = undefined;
|
|
128
|
+
releaseCleanup?.();
|
|
129
|
+
}
|
|
130
|
+
nativeExit.resolve();
|
|
131
|
+
},
|
|
132
|
+
stop() {
|
|
133
|
+
if (!alive() || stopping) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
stopping = true;
|
|
137
|
+
if (options.killTree !== true || child.pid === undefined) {
|
|
138
|
+
close();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Capture before EOF/taskkill too: an intermediate Windows parent may
|
|
142
|
+
// exit first, leaving tools outside taskkill's remaining parent chain.
|
|
143
|
+
const prepared = prepare();
|
|
144
|
+
phase = captureAndClose(prepared);
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=process-shutdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-shutdown.js","sources":["../../../src/shared/executable/process-shutdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAIxF,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,KAAmB,EAAE,OAAwB;IAU3E,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7C,IAAI,UAAU,GAA+B,SAAS,CAAC;IACvD,IAAI,OAAO,GAAsD,SAAS,CAAC;IAC3E,IAAI,OAAO,GAA8B,SAAS,CAAC;IACnD,IAAI,cAAc,GAA6B,SAAS,CAAC;IACzD,M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ACnE,OAAO,GAAG,SAAS,CAAC;gBACpB,cAAc,EAAE,EAAE,CAAC;YACrB,CAAC;YACD,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;QACD,IAAI;YACF,IAAI,CAAC,KAAK,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YACrC,QAAQ,GAAG,IAAI,CAAC;YAChB,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;gBAAC,KAAK,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YAC9E,sEAAsE;YACtE,uEAAuE;YACvE,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;YAC3B,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* How long a process asked to stop (SIGTERM) gets before it is killed outright
|
|
4
|
+
* (SIGKILL): the bound that keeps `kill()` followed by `await exited` from
|
|
5
|
+
* hanging on a process that ignores the request. Generous on purpose: claude
|
|
6
|
+
* answers SIGTERM with a shutdown of its own that runs its SessionEnd hooks
|
|
7
|
+
* and force-exits after max(5 s, hook budget + 5 s), 15 s while writes are
|
|
8
|
+
* still pending (2.1.283; the hook budget defaults to 1.5 s), and cutting that
|
|
9
|
+
* short kills the hooks with it. Observed exits take 0.6-2.3 s.
|
|
10
|
+
*/
|
|
11
|
+
export declare const KILL_GRACE_MS = 10000;
|
|
12
|
+
/**
|
|
13
|
+
* The grace period in force: `OAR_KILL_GRACE_MS` when it holds a nonnegative
|
|
14
|
+
* number of milliseconds (a host whose runtimes need longer, e.g. claude with
|
|
15
|
+
* slow SessionEnd hooks, or that wants a faster teardown), else `KILL_GRACE_MS`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function killGraceMs(env?: NodeJS.ProcessEnv): number;
|
|
18
|
+
/**
|
|
19
|
+
* POSIX children are spawned detached, which makes each the leader of its own
|
|
20
|
+
* process group, so one signal to the negative pid reaches every process it
|
|
21
|
+
* started (shells, dev servers, MCP servers), not only the child itself.
|
|
22
|
+
* Detaching changes neither stdio nor exit tracking: the pipes stay connected
|
|
23
|
+
* and the child is never unref'd, so the host still observes its exit. It does
|
|
24
|
+
* take the child out of the terminal's job control: Ctrl-C (SIGINT) and SIGHUP
|
|
25
|
+
* reach the host only, so a host that wants them to stop its runtimes
|
|
26
|
+
* disposes its sessions on them. Windows has no process groups, and a
|
|
27
|
+
* detached child there gets its own console, so it stays attached.
|
|
28
|
+
*/
|
|
29
|
+
export declare const OWN_PROCESS_GROUP: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Send `signal` to a child spawned with `detached: OWN_PROCESS_GROUP` and to
|
|
32
|
+
* everything in its process group. Falls back to the child alone where there
|
|
33
|
+
* are no groups (Windows) or the group is gone (the child left it; ESRCH).
|
|
34
|
+
* A reaped child's pid can be reused, so call this only while the child, or a
|
|
35
|
+
* process it started, can still be alive.
|
|
36
|
+
*/
|
|
37
|
+
export declare function signalProcessGroup(child: ChildProcess, signal: NodeJS.Signals): void;
|
|
38
|
+
/**
|
|
39
|
+
* Windows taskkill /T /F ends the child and its descendants, falling back to
|
|
40
|
+
* the child alone when the walk fails. An exited child's pid may already be reused.
|
|
41
|
+
*/
|
|
42
|
+
export declare function killProcessTree(child: ChildProcess): void;
|
|
43
|
+
//# sourceMappingURL=process-signals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-signals.d.ts","sources":["../../../src/shared/executable/process-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAIxE;AACD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,SAA+B,CAAC;AAC9D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAWpF;AACD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAYzD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { trackOwnedProcess } from "./ownership.js";
|
|
3
|
+
/**
|
|
4
|
+
* How long a process asked to stop (SIGTERM) gets before it is killed outright
|
|
5
|
+
* (SIGKILL): the bound that keeps `kill()` followed by `await exited` from
|
|
6
|
+
* hanging on a process that ignores the request. Generous on purpose: claude
|
|
7
|
+
* answers SIGTERM with a shutdown of its own that runs its SessionEnd hooks
|
|
8
|
+
* and force-exits after max(5 s, hook budget + 5 s), 15 s while writes are
|
|
9
|
+
* still pending (2.1.283; the hook budget defaults to 1.5 s), and cutting that
|
|
10
|
+
* short kills the hooks with it. Observed exits take 0.6-2.3 s.
|
|
11
|
+
*/
|
|
12
|
+
export const KILL_GRACE_MS = 10_000;
|
|
13
|
+
/**
|
|
14
|
+
* The grace period in force: `OAR_KILL_GRACE_MS` when it holds a nonnegative
|
|
15
|
+
* number of milliseconds (a host whose runtimes need longer, e.g. claude with
|
|
16
|
+
* slow SessionEnd hooks, or that wants a faster teardown), else `KILL_GRACE_MS`.
|
|
17
|
+
*/
|
|
18
|
+
export function killGraceMs(env = process.env) {
|
|
19
|
+
const configured = env.OAR_KILL_GRACE_MS?.trim() ?? "";
|
|
20
|
+
const value = Number(configured);
|
|
21
|
+
return configured.length > 0 && Number.isFinite(value) && value >= 0 ? value : KILL_GRACE_MS;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* POSIX children are spawned detached, which makes each the leader of its own
|
|
25
|
+
* process group, so one signal to the negative pid reaches every process it
|
|
26
|
+
* started (shells, dev servers, MCP servers), not only the child itself.
|
|
27
|
+
* Detaching changes neither stdio nor exit tracking: the pipes stay connected
|
|
28
|
+
* and the child is never unref'd, so the host still observes its exit. It does
|
|
29
|
+
* take the child out of the terminal's job control: Ctrl-C (SIGINT) and SIGHUP
|
|
30
|
+
* reach the host only, so a host that wants them to stop its runtimes
|
|
31
|
+
* disposes its sessions on them. Windows has no process groups, and a
|
|
32
|
+
* detached child there gets its own console, so it stays attached.
|
|
33
|
+
*/
|
|
34
|
+
export const OWN_PROCESS_GROUP = process.platform !== "win32";
|
|
35
|
+
/**
|
|
36
|
+
* Send `signal` to a child spawned with `detached: OWN_PROCESS_GROUP` and to
|
|
37
|
+
* everything in its process group. Falls back to the child alone where there
|
|
38
|
+
* are no groups (Windows) or the group is gone (the child left it; ESRCH).
|
|
39
|
+
* A reaped child's pid can be reused, so call this only while the child, or a
|
|
40
|
+
* process it started, can still be alive.
|
|
41
|
+
*/
|
|
42
|
+
export function signalProcessGroup(child, signal) {
|
|
43
|
+
if (OWN_PROCESS_GROUP && child.pid !== undefined) {
|
|
44
|
+
try {
|
|
45
|
+
process.kill(-child.pid, signal);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Nobody is left in the group; the child itself may still be alive in
|
|
50
|
+
// a group of its own making, so it is signalled directly below.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
child.kill(signal);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Windows taskkill /T /F ends the child and its descendants, falling back to
|
|
57
|
+
* the child alone when the walk fails. An exited child's pid may already be reused.
|
|
58
|
+
*/
|
|
59
|
+
export function killProcessTree(child) {
|
|
60
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (child.pid === undefined) {
|
|
64
|
+
child.kill();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const killer = execFile("taskkill", ["/pid", String(child.pid), "/T", "/F"], { windowsHide: true }, (error) => {
|
|
68
|
+
if (error !== null) {
|
|
69
|
+
child.kill();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
trackOwnedProcess(killer);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=process-signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-signals.js","sources":["../../../src/shared/executable/process-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC9D,MAAM,UAAU,GAAG,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC;AAC/F,CAAC;AACD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAC9D;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAmB,EAAE,MAAsB;IAC5E,IAAI,iBAAiB,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC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