@schuttdev/gigai 0.1.0-beta.19 → 0.1.0-beta.20
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 +19 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -622,8 +622,25 @@ function runCitty() {
|
|
|
622
622
|
stop: defineCommand({
|
|
623
623
|
meta: { name: "stop", description: "Stop the running gigai server" },
|
|
624
624
|
async run() {
|
|
625
|
-
const {
|
|
626
|
-
|
|
625
|
+
const { execFileSync } = await import("child_process");
|
|
626
|
+
let pids = [];
|
|
627
|
+
try {
|
|
628
|
+
const out = execFileSync("pgrep", ["-f", "gigai server start"], { encoding: "utf8" });
|
|
629
|
+
pids = out.trim().split("\n").map(Number).filter((pid) => pid && pid !== process.pid);
|
|
630
|
+
} catch {
|
|
631
|
+
}
|
|
632
|
+
if (pids.length === 0) {
|
|
633
|
+
console.log("No running gigai server found.");
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
for (const pid of pids) {
|
|
637
|
+
try {
|
|
638
|
+
process.kill(pid, "SIGTERM");
|
|
639
|
+
console.log(`Stopped gigai server (PID ${pid})`);
|
|
640
|
+
} catch (e) {
|
|
641
|
+
console.error(`Failed to stop PID ${pid}: ${e.message}`);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
627
644
|
}
|
|
628
645
|
}),
|
|
629
646
|
status: defineCommand({
|