MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / stopBot

Function stopBot

src/cli/bot-process.ts:55–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55export async function stopBot(): Promise<{ ok: boolean; message: string }> {
56 const cur = await botStatus();
57 if (!cur.running || !cur.pid) { await fs.unlink(pidFilePath()).catch(() => {}); return { ok: false, message: 'Bot is not running.' }; }
58 try {
59 process.kill(cur.pid, 'SIGTERM');
60 await fs.unlink(pidFilePath()).catch(() => {});
61 return { ok: true, message: `Stopped the bot (pid ${cur.pid}).` };
62 } catch (e: any) {
63 return { ok: false, message: `Couldn't stop pid ${cur.pid}: ${e?.message ?? e}` };
64 }
65}

Callers 1

dispatchActionFunction · 0.85

Calls 2

botStatusFunction · 0.85
pidFilePathFunction · 0.85

Tested by

no test coverage detected