@botiverse/oar 0.36.0 → 0.36.1
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/shared/executable/ownership.d.ts +4 -2
- package/dist/shared/executable/ownership.d.ts.map +1 -1
- package/dist/shared/executable/ownership.js +15 -4
- package/dist/shared/executable/ownership.js.map +1 -1
- package/dist/shared/executable/process-tree.d.ts +24 -0
- package/dist/shared/executable/process-tree.d.ts.map +1 -0
- package/dist/shared/executable/process-tree.js +123 -0
- package/dist/shared/executable/process-tree.js.map +1 -0
- package/dist/shared/executable/process.d.ts +12 -6
- package/dist/shared/executable/process.d.ts.map +1 -1
- package/dist/shared/executable/process.js +26 -0
- package/dist/shared/executable/process.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ import { type ChildProcess } from "node:child_process";
|
|
|
3
3
|
* Own a detached POSIX group or Windows tree until its output pipes close:
|
|
4
4
|
* descendants may hold them after the launcher exits. One synchronous hook
|
|
5
5
|
* covers sessions, probes, updaters, logins and ACP terminals when a host
|
|
6
|
-
* calls process.exit without disposing them
|
|
7
|
-
*
|
|
6
|
+
* calls process.exit without disposing them; on POSIX it also SIGKILLs the
|
|
7
|
+
* descendants of a child still running that left its group, and their groups
|
|
8
|
+
* (process-tree.ts). Node does not emit `exit` for an unhandled terminating
|
|
9
|
+
* signal or SIGKILL; hosts own graceful handling.
|
|
8
10
|
*/
|
|
9
11
|
export declare function trackOwnedProcess(child: ChildProcess): void;
|
|
10
12
|
//# sourceMappingURL=ownership.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiCrE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAiB3D"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { descendantsOf, killEntries, readProcessTable } from "./process-tree.js";
|
|
2
3
|
const ownedChildren = new Set();
|
|
3
4
|
let exitHookInstalled = false;
|
|
4
|
-
function killOwnedProcess(child) {
|
|
5
|
+
function killOwnedProcess(child, table) {
|
|
5
6
|
try {
|
|
6
7
|
if (child.pid !== undefined) {
|
|
7
8
|
if (process.platform === "win32") {
|
|
@@ -16,6 +17,11 @@ function killOwnedProcess(child) {
|
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
20
|
+
// Its descendants outside its group too, found below it only while
|
|
21
|
+
// it runs: a reaped pid may already be someone else's.
|
|
22
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
23
|
+
killEntries(descendantsOf(table(), child.pid), table());
|
|
24
|
+
}
|
|
19
25
|
process.kill(-child.pid, "SIGKILL");
|
|
20
26
|
}
|
|
21
27
|
return;
|
|
@@ -33,8 +39,10 @@ function killOwnedProcess(child) {
|
|
|
33
39
|
* Own a detached POSIX group or Windows tree until its output pipes close:
|
|
34
40
|
* descendants may hold them after the launcher exits. One synchronous hook
|
|
35
41
|
* covers sessions, probes, updaters, logins and ACP terminals when a host
|
|
36
|
-
* calls process.exit without disposing them
|
|
37
|
-
*
|
|
42
|
+
* calls process.exit without disposing them; on POSIX it also SIGKILLs the
|
|
43
|
+
* descendants of a child still running that left its group, and their groups
|
|
44
|
+
* (process-tree.ts). Node does not emit `exit` for an unhandled terminating
|
|
45
|
+
* signal or SIGKILL; hosts own graceful handling.
|
|
38
46
|
*/
|
|
39
47
|
export function trackOwnedProcess(child) {
|
|
40
48
|
ownedChildren.add(child);
|
|
@@ -49,8 +57,11 @@ export function trackOwnedProcess(child) {
|
|
|
49
57
|
if (!exitHookInstalled) {
|
|
50
58
|
exitHookInstalled = true;
|
|
51
59
|
process.once("exit", () => {
|
|
60
|
+
// One read of the process table serves every child.
|
|
61
|
+
let table = null;
|
|
62
|
+
const read = () => { table ??= readProcessTable(); return table; };
|
|
52
63
|
for (const owned of ownedChildren) {
|
|
53
|
-
killOwnedProcess(owned);
|
|
64
|
+
killOwnedProcess(owned, read);
|
|
54
65
|
}
|
|
55
66
|
});
|
|
56
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../../../src/shared/executable/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AAEpG,MAAM,aAAa,GAAG,IAAI,GAAG,EAAgB,CAAC;AAC9C,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B,SAAS,gBAAgB,CAAC,KAAmB,EAAE,KAAyB;IACtE,IAAI,CAAC;QACH,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACjC,kEAAkE;gBAClE,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;oBAAC,OAAO;gBAAC,CAAC;gBACrE,mEAAmE;gBACnE,iEAAiE;gBACjE,YAAY,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,I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AM,EAAE,GAAG,EAAE;YACxB,oDAAoD;YACpD,IAAI,KAAK,GAAwB,IAAI,CAAC;YACtC,MAAM,IAAI,GAAG,GAAiB,EAAE,GAAG,KAAK,KAAK,gBAAgB,EAAE,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;YACjF,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;gBAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** One process in the table. `start` tells it from a later process given the same pid. */
|
|
2
|
+
export interface ProcessEntry {
|
|
3
|
+
readonly pid: number;
|
|
4
|
+
readonly ppid: number;
|
|
5
|
+
readonly pgid: number;
|
|
6
|
+
readonly start: string;
|
|
7
|
+
}
|
|
8
|
+
/** The process table at one moment, by pid. */
|
|
9
|
+
export type ProcessTable = ReadonlyMap<number, ProcessEntry>;
|
|
10
|
+
/**
|
|
11
|
+
* The process table now (synchronous: the host's `exit` hook reads it too).
|
|
12
|
+
* Empty when it cannot be read; the caller then reaches the process group only.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readProcessTable(source?: "procfs" | "ps"): ProcessTable;
|
|
15
|
+
/** Every process below `pid` in `table`: its children, theirs, and so on. */
|
|
16
|
+
export declare function descendantsOf(table: ProcessTable, pid: number): ProcessEntry[];
|
|
17
|
+
/**
|
|
18
|
+
* SIGKILL each of `entries` that `table` (read just before) shows still
|
|
19
|
+
* running, the same process (same start time), and the process group each
|
|
20
|
+
* belongs to now: the runtime's own, or one a descendant made, which can hold
|
|
21
|
+
* processes started since the entries were read. Never the host, nor its group.
|
|
22
|
+
*/
|
|
23
|
+
export declare function killEntries(entries: Iterable<ProcessEntry>, table: ProcessTable): void;
|
|
24
|
+
//# sourceMappingURL=process-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree.d.ts","sourceRoot":"","sources":["../../../src/shared/executable/process-tree.ts"],"names":[],"mappings":"AAcA,0FAA0F;AAC1F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAiD7D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,QAAQ,GAAG,IAAqD,GAAG,YAAY,CAMvH;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CAuB9E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CA4BtF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
/** `/proc/<pid>/stat`'s ppid, pgrp and starttime (clock ticks since boot); null once the process is gone. */
|
|
4
|
+
function readStat(pid) {
|
|
5
|
+
let stat = "";
|
|
6
|
+
try {
|
|
7
|
+
stat = readFileSync(`/proc/${String(pid)}/stat`, "utf8");
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
// Field 2, the command name, is parenthesized and may itself hold spaces
|
|
13
|
+
// and parentheses; the fields after its last ")" start at field 3 (state).
|
|
14
|
+
const fields = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
|
|
15
|
+
const [ppid, pgid, start] = [Number(fields[1]), Number(fields[2]), fields[19]];
|
|
16
|
+
return Number.isInteger(ppid) && Number.isInteger(pgid) && start !== undefined ? { pid, ppid, pgid, start } : null;
|
|
17
|
+
}
|
|
18
|
+
/** Linux: every process's stat. */
|
|
19
|
+
function readProcfs() {
|
|
20
|
+
const table = new Map();
|
|
21
|
+
for (const name of readdirSync("/proc")) {
|
|
22
|
+
const entry = /^\d+$/u.test(name) ? readStat(Number(name)) : null;
|
|
23
|
+
if (entry !== null) {
|
|
24
|
+
table.set(entry.pid, entry);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return table;
|
|
28
|
+
}
|
|
29
|
+
/** Other POSIX systems (macOS): one `ps` run; `lstart` is the start time to the second. */
|
|
30
|
+
function readPs() {
|
|
31
|
+
const output = execFileSync("ps", ["-A", "-o", "pid=,ppid=,pgid=,lstart="], {
|
|
32
|
+
encoding: "utf8",
|
|
33
|
+
env: { ...process.env, LC_ALL: "C" },
|
|
34
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
35
|
+
timeout: 5000,
|
|
36
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
37
|
+
});
|
|
38
|
+
const table = new Map();
|
|
39
|
+
for (const line of output.split("\n")) {
|
|
40
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S.*?)\s*$/u.exec(line);
|
|
41
|
+
if (match !== null) {
|
|
42
|
+
const pid = Number(match[1]);
|
|
43
|
+
table.set(pid, { pid, ppid: Number(match[2]), pgid: Number(match[3]), start: match[4] ?? "" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return table;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The process table now (synchronous: the host's `exit` hook reads it too).
|
|
50
|
+
* Empty when it cannot be read; the caller then reaches the process group only.
|
|
51
|
+
*/
|
|
52
|
+
export function readProcessTable(source = process.platform === "linux" ? "procfs" : "ps") {
|
|
53
|
+
try {
|
|
54
|
+
return source === "procfs" ? readProcfs() : readPs();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return new Map();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Every process below `pid` in `table`: its children, theirs, and so on. */
|
|
61
|
+
export function descendantsOf(table, pid) {
|
|
62
|
+
const children = new Map();
|
|
63
|
+
for (const entry of table.values()) {
|
|
64
|
+
const siblings = children.get(entry.ppid);
|
|
65
|
+
if (siblings === undefined) {
|
|
66
|
+
children.set(entry.ppid, [entry]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
siblings.push(entry);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const found = [];
|
|
73
|
+
const seen = new Set([pid]);
|
|
74
|
+
const pending = [pid];
|
|
75
|
+
for (let parent = pending.pop(); parent !== undefined; parent = pending.pop()) {
|
|
76
|
+
for (const child of children.get(parent) ?? []) {
|
|
77
|
+
if (!seen.has(child.pid)) {
|
|
78
|
+
seen.add(child.pid);
|
|
79
|
+
found.push(child);
|
|
80
|
+
pending.push(child.pid);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return found;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* SIGKILL each of `entries` that `table` (read just before) shows still
|
|
88
|
+
* running, the same process (same start time), and the process group each
|
|
89
|
+
* belongs to now: the runtime's own, or one a descendant made, which can hold
|
|
90
|
+
* processes started since the entries were read. Never the host, nor its group.
|
|
91
|
+
*/
|
|
92
|
+
export function killEntries(entries, table) {
|
|
93
|
+
const hostGroup = table.get(process.pid)?.pgid;
|
|
94
|
+
const groups = new Set();
|
|
95
|
+
const pids = new Set();
|
|
96
|
+
for (const entry of entries) {
|
|
97
|
+
const current = table.get(entry.pid);
|
|
98
|
+
if (current === undefined || current.start !== entry.start || current.pid === process.pid) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
pids.add(current.pid);
|
|
102
|
+
if (current.pgid > 1 && current.pgid !== hostGroup) {
|
|
103
|
+
groups.add(current.pgid);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const group of groups) {
|
|
107
|
+
try {
|
|
108
|
+
process.kill(-group, "SIGKILL");
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// The group emptied meanwhile.
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const pid of pids) {
|
|
115
|
+
try {
|
|
116
|
+
process.kill(pid, "SIGKILL");
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// Gone meanwhile.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=process-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-tree.js","sourceRoot":"","sources":["../../../src/shared/executable/process-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwBpD,6GAA6G;AAC7G,SAAS,QAAQ,CAAC,GAAW;IAC3B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,yEAAyE;IACzE,2EAA2E;IAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,C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AAC,KAAK,IAAI,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1F,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;QACjC,CAAC;IACH,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -12,9 +12,14 @@ export interface LineProcessOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
readonly inheritStderr?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* ({@link killProcessTree})
|
|
17
|
-
* npm `.cmd` shim is only `cmd.exe`. POSIX
|
|
15
|
+
* `kill()` ends the child's whole process tree. On Windows
|
|
16
|
+
* ({@link killProcessTree}) that is more than the direct child, which for an
|
|
17
|
+
* npm `.cmd` shim is only `cmd.exe`. On POSIX, where the child's process
|
|
18
|
+
* group is always signalled, it adds the descendants that left the group
|
|
19
|
+
* (process-tree.ts): SIGTERM still goes to the group alone, so the child
|
|
20
|
+
* can stop its tools itself; the SIGKILL, or the child's exit if that comes
|
|
21
|
+
* first, also takes every descendant seen before (when `kill()` began, and
|
|
22
|
+
* again just before the SIGKILL) and the groups they belong to.
|
|
18
23
|
*/
|
|
19
24
|
readonly killTree?: boolean;
|
|
20
25
|
}
|
|
@@ -75,9 +80,10 @@ export interface LineProcess {
|
|
|
75
80
|
/**
|
|
76
81
|
* Stop the process and everything it started: close stdin, SIGTERM its
|
|
77
82
|
* process group, and SIGKILL the group if the child is still running once
|
|
78
|
-
* the grace period is over
|
|
79
|
-
*
|
|
80
|
-
*
|
|
83
|
+
* the grace period is over; with `killTree`, its descendants outside the
|
|
84
|
+
* group too. On Windows it ends the child alone, or its whole tree with
|
|
85
|
+
* `killTree`. Idempotent; a no-op after the exit, since a reaped pid may
|
|
86
|
+
* already belong to another process.
|
|
81
87
|
*/
|
|
82
88
|
kill(): void;
|
|
83
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/shared/executable/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/shared/executable/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAIpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC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B,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAEjF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,kBAAuB,GAC/B,WAAW,CAoJb"}
|
|
@@ -3,6 +3,7 @@ import spawn from "cross-spawn";
|
|
|
3
3
|
import { StringDecoder } from "node:string_decoder";
|
|
4
4
|
import { nativeError, StderrTail } from "./diagnostics.js";
|
|
5
5
|
import { trackOwnedProcess } from "./ownership.js";
|
|
6
|
+
import { descendantsOf, killEntries, readProcessTable } from "./process-tree.js";
|
|
6
7
|
export { trackOwnedProcess } from "./ownership.js";
|
|
7
8
|
/**
|
|
8
9
|
* How long a process asked to stop (SIGTERM) gets before it is killed outright
|
|
@@ -112,6 +113,9 @@ export function spawnLineProcess(command, args, options = {}) {
|
|
|
112
113
|
let exitSignal = null;
|
|
113
114
|
let spawnError = undefined;
|
|
114
115
|
let escalation = null;
|
|
116
|
+
// POSIX `killTree`: the child's descendants when kill() began, until they
|
|
117
|
+
// have had their SIGKILL.
|
|
118
|
+
let descendants = [];
|
|
115
119
|
const { promise: spawned, resolve: spawnOk, reject: spawnFailed } = Promise.withResolvers();
|
|
116
120
|
const { promise: exited, resolve: exitDone } = Promise.withResolvers();
|
|
117
121
|
child.once("spawn", spawnOk);
|
|
@@ -125,6 +129,12 @@ export function spawnLineProcess(command, args, options = {}) {
|
|
|
125
129
|
if (escalation !== null) {
|
|
126
130
|
clearTimeout(escalation);
|
|
127
131
|
}
|
|
132
|
+
if (descendants.length > 0) {
|
|
133
|
+
// The child stopped before its SIGKILL: what it left running of its
|
|
134
|
+
// tree now belongs to nobody, and goes before the exit is reported.
|
|
135
|
+
killEntries(descendants, readProcessTable());
|
|
136
|
+
descendants = [];
|
|
137
|
+
}
|
|
128
138
|
for (const handler of exitHandlers) {
|
|
129
139
|
handler(code);
|
|
130
140
|
}
|
|
@@ -195,11 +205,27 @@ export function spawnLineProcess(command, args, options = {}) {
|
|
|
195
205
|
}, killGraceMs());
|
|
196
206
|
return;
|
|
197
207
|
}
|
|
208
|
+
const { pid } = child;
|
|
209
|
+
const tree = options.killTree === true && pid !== undefined;
|
|
210
|
+
if (tree) {
|
|
211
|
+
// Read while the child runs: once it is gone, what left its group is
|
|
212
|
+
// re-parented and no longer found below it.
|
|
213
|
+
descendants = descendantsOf(readProcessTable(), pid);
|
|
214
|
+
}
|
|
198
215
|
signalProcessGroup(child, "SIGTERM");
|
|
199
216
|
// Cleared by the exit, so it only fires on a process that ignored the
|
|
200
217
|
// SIGTERM; the SIGKILL then takes its whole group down with it.
|
|
201
218
|
escalation = setTimeout(() => {
|
|
219
|
+
if (!tree) {
|
|
220
|
+
signalProcessGroup(child, "SIGKILL");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
// Read again first: the child may have started more since.
|
|
224
|
+
const table = readProcessTable();
|
|
225
|
+
const now = descendantsOf(table, pid);
|
|
202
226
|
signalProcessGroup(child, "SIGKILL");
|
|
227
|
+
killEntries([...descendants, ...now], table);
|
|
228
|
+
descendants = [];
|
|
203
229
|
}, killGraceMs());
|
|
204
230
|
},
|
|
205
231
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/shared/executable/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAA2B,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/shared/executable/process.ts"],"names":[],"mapp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,KAAK,EAAE,SAAS,CAAC,CAAC;gBACrC,WAAW,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC7C,WAAW,GAAG,EAAE,CAAC;YACnB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/oar",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"description": "A programming interface for all agent harnesses: provider-independent contracts for controlling and observing agent runtimes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|