fix(cli): bypass already running check if matching current process pid

This commit is contained in:
yiling
2026-06-20 12:53:14 +08:00
parent d4a1eff715
commit c6527650d0
+2 -2
View File
@@ -94,7 +94,7 @@ function startDaemon(appName: string, pidFile: string, logFile: string): void {
// Check if already running
if (existsSync(pidFile)) {
const pid = parseInt(readFileSync(pidFile, 'utf8').trim(), 10)
if (!isNaN(pid)) {
if (!isNaN(pid) && pid !== process.pid) {
try {
process.kill(pid, 0)
console.error(
@@ -218,7 +218,7 @@ export async function handleDaemonCommands(
// Normal Startup logic: check if already running
if (existsSync(pidFile)) {
const pid = parseInt(readFileSync(pidFile, 'utf8').trim(), 10)
if (!isNaN(pid)) {
if (!isNaN(pid) && pid !== process.pid) {
try {
process.kill(pid, 0)
console.error(