mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-01-30 06:12:06 +00:00
fix ccr start error
This commit is contained in:
@@ -14,7 +14,7 @@ import { writeFileSync, existsSync, readFileSync } from "fs";
|
|||||||
import { checkForUpdates, performUpdate } from "./update";
|
import { checkForUpdates, performUpdate } from "./update";
|
||||||
import { version } from "../../package.json";
|
import { version } from "../../package.json";
|
||||||
import { spawn } from "child_process";
|
import { spawn } from "child_process";
|
||||||
import { cleanupPidFile } from "./processCheck";
|
import {cleanupPidFile, isServiceRunning} from "./processCheck";
|
||||||
|
|
||||||
// Function to interpolate environment variables in config values
|
// Function to interpolate environment variables in config values
|
||||||
const interpolateEnvVars = (obj: any): any => {
|
const interpolateEnvVars = (obj: any): any => {
|
||||||
@@ -180,6 +180,11 @@ export const initConfig = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const run = async (args: string[] = []) => {
|
export const run = async (args: string[] = []) => {
|
||||||
|
const isRunning = isServiceRunning()
|
||||||
|
if (isRunning) {
|
||||||
|
console.log('claude-code-router server is running');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const server = await getServer();
|
const server = await getServer();
|
||||||
// Save the PID of the background process
|
// Save the PID of the background process
|
||||||
writeFileSync(PID_FILE, process.pid.toString());
|
writeFileSync(PID_FILE, process.pid.toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user