open-agents-ai 0.187.308 → 0.187.309
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/index.js +34 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -328402,18 +328402,44 @@ function killScheduledProcesses(pids, pattern) {
|
|
|
328402
328402
|
const killed = [];
|
|
328403
328403
|
try {
|
|
328404
328404
|
const { execSync: es } = __require("node:child_process");
|
|
328405
|
+
const targets = /* @__PURE__ */ new Set();
|
|
328405
328406
|
if (pids && pids.length > 0) {
|
|
328406
|
-
for (const pid of pids)
|
|
328407
|
-
|
|
328408
|
-
|
|
328409
|
-
|
|
328410
|
-
|
|
328411
|
-
|
|
328407
|
+
for (const pid of pids) if (Number.isInteger(pid)) targets.add(pid);
|
|
328408
|
+
} else {
|
|
328409
|
+
try {
|
|
328410
|
+
const ps = es("ps -eo pid,command", { encoding: "utf8", stdio: "pipe" });
|
|
328411
|
+
const re = new RegExp(pattern, "i");
|
|
328412
|
+
for (const line of ps.split("\n")) {
|
|
328413
|
+
const m2 = line.trim().match(/^(\d+)\s+(.*)$/);
|
|
328414
|
+
if (!m2) continue;
|
|
328415
|
+
const pid = parseInt(m2[1], 10);
|
|
328416
|
+
const cmd = m2[2] || "";
|
|
328417
|
+
if (!isFinite(pid)) continue;
|
|
328418
|
+
if (re.test(cmd)) targets.add(pid);
|
|
328412
328419
|
}
|
|
328420
|
+
} catch {
|
|
328413
328421
|
}
|
|
328414
|
-
}
|
|
328422
|
+
}
|
|
328423
|
+
for (const pid of targets) {
|
|
328415
328424
|
try {
|
|
328416
|
-
|
|
328425
|
+
process.kill(pid, "SIGTERM");
|
|
328426
|
+
killed.push({ pid, ok: true, signal: "TERM" });
|
|
328427
|
+
} catch {
|
|
328428
|
+
killed.push({ pid, ok: false, signal: "TERM" });
|
|
328429
|
+
}
|
|
328430
|
+
}
|
|
328431
|
+
const start2 = Date.now();
|
|
328432
|
+
while (Date.now() - start2 < 500) {
|
|
328433
|
+
}
|
|
328434
|
+
for (const pid of targets) {
|
|
328435
|
+
try {
|
|
328436
|
+
process.kill(pid, 0);
|
|
328437
|
+
try {
|
|
328438
|
+
process.kill(pid, "SIGKILL");
|
|
328439
|
+
killed.push({ pid, ok: true, signal: "KILL" });
|
|
328440
|
+
} catch {
|
|
328441
|
+
killed.push({ pid, ok: false, signal: "KILL" });
|
|
328442
|
+
}
|
|
328417
328443
|
} catch {
|
|
328418
328444
|
}
|
|
328419
328445
|
}
|
package/package.json
CHANGED