fix the issue of multiple calude using one server by claude code

This commit is contained in:
jinhui.li
2025-06-12 09:58:05 +08:00
parent c9059f146d
commit 84e76f24b0
5 changed files with 67 additions and 13 deletions

View File

@@ -43,10 +43,12 @@ async function waitForService(
return false;
}
import { spawn } from "child_process";
async function main() {
switch (command) {
case "start":
await run({ daemon: true });
run();
break;
case "stop":
await closeService();
@@ -57,8 +59,10 @@ async function main() {
case "code":
if (!isServiceRunning()) {
console.log("Service not running, starting service...");
await run({ daemon: true });
// Wait for service to start, exit with error if timeout
spawn("ccr", ["start"], {
detached: true,
stdio: "ignore",
}).unref();
if (await waitForService()) {
executeCodeCommand(process.argv.slice(3));
} else {