@clawos-dev/clawd 0.2.119-beta.236.8805685 → 0.2.120-beta.237.5d8e8a2
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/cli.cjs +25 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -41651,7 +41651,7 @@ function buildExtensionHandlers(deps) {
|
|
|
41651
41651
|
|
|
41652
41652
|
// src/app-builder/kill-port.ts
|
|
41653
41653
|
var import_node_child_process7 = require("child_process");
|
|
41654
|
-
async function killPortOccupants(port, logger) {
|
|
41654
|
+
async function killPortOccupants(port, ownedPids, logger) {
|
|
41655
41655
|
let pids;
|
|
41656
41656
|
try {
|
|
41657
41657
|
pids = await listPidsOnPort(port);
|
|
@@ -41667,6 +41667,14 @@ async function killPortOccupants(port, logger) {
|
|
|
41667
41667
|
return;
|
|
41668
41668
|
}
|
|
41669
41669
|
for (const pid of pids) {
|
|
41670
|
+
if (!ownedPids.has(pid)) {
|
|
41671
|
+
logger?.warn("app-builder.kill-port.skip-external", {
|
|
41672
|
+
port,
|
|
41673
|
+
pid,
|
|
41674
|
+
hint: "pid not in supervisor owned set; might be another daemon or external process. handle manually via lsof + kill."
|
|
41675
|
+
});
|
|
41676
|
+
continue;
|
|
41677
|
+
}
|
|
41670
41678
|
try {
|
|
41671
41679
|
process.kill(pid, "SIGKILL");
|
|
41672
41680
|
logger?.info("app-builder.kill-port-occupant", { port, pid });
|
|
@@ -41714,7 +41722,7 @@ function buildAppBuilderHandlers(deps) {
|
|
|
41714
41722
|
function getStageOf(name) {
|
|
41715
41723
|
const recorded = stages.get(name);
|
|
41716
41724
|
if (recorded) return recorded;
|
|
41717
|
-
return devServerLifecycle.isRunning(name) ? { stage: "running" } : { stage: "
|
|
41725
|
+
return devServerLifecycle.isRunning(name) ? { stage: "running" } : { stage: "stopped" };
|
|
41718
41726
|
}
|
|
41719
41727
|
async function setStageAndBroadcast(name, stage, reason) {
|
|
41720
41728
|
if (reason !== void 0) {
|
|
@@ -41972,7 +41980,7 @@ function buildAppBuilderHandlers(deps) {
|
|
|
41972
41980
|
const projects = await store.list();
|
|
41973
41981
|
const meta = projects.find((p2) => p2.name === projectName);
|
|
41974
41982
|
if (meta) {
|
|
41975
|
-
await killPortOccupants(meta.port, deps.logger);
|
|
41983
|
+
await killPortOccupants(meta.port, devServerLifecycle.getOwnedPids(), deps.logger);
|
|
41976
41984
|
}
|
|
41977
41985
|
} catch (err) {
|
|
41978
41986
|
deps.logger?.warn("app-builder.stop-dev-server.kill-port-skipped", {
|
|
@@ -42496,6 +42504,20 @@ var DevServerSupervisor = class extends import_node_events2.EventEmitter {
|
|
|
42496
42504
|
isRunning(projectName) {
|
|
42497
42505
|
return [...this.running.values()].some((e) => e.projectName === projectName);
|
|
42498
42506
|
}
|
|
42507
|
+
/**
|
|
42508
|
+
* 多 daemon fix (#803 follow-up): 返回 supervisor 当前 spawn 着的所有子进程 pid 集合。
|
|
42509
|
+
* stopDevServer handler 调 killPortOccupants 时传入做白名单,避免无差别 kill 端口上的
|
|
42510
|
+
* 进程把另一个 daemon (.clawd / .clawd-second) 的 dev server 也连带杀。
|
|
42511
|
+
* undefined pid(spawn 还没拿到 pid 的极短窗口)会被过滤掉。
|
|
42512
|
+
*/
|
|
42513
|
+
getOwnedPids() {
|
|
42514
|
+
const pids = /* @__PURE__ */ new Set();
|
|
42515
|
+
for (const entry of this.running.values()) {
|
|
42516
|
+
const pid = entry.process.pid;
|
|
42517
|
+
if (typeof pid === "number" && pid > 0) pids.add(pid);
|
|
42518
|
+
}
|
|
42519
|
+
return pids;
|
|
42520
|
+
}
|
|
42499
42521
|
boundSessionId(projectName) {
|
|
42500
42522
|
const entry = [...this.running.values()].find((e) => e.projectName === projectName);
|
|
42501
42523
|
return entry?.sessionId ?? null;
|
package/package.json
CHANGED