MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / exitServer

Function exitServer

examples/agents/readme-writer-agent/utils/exit-server.ts:4–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import {spawn} from 'child_process';
3
4export async function exitServer() {
5 const spinner = p.spinner();
6 spinner.start('Stopping AI server...');
7 // Spawn the server process detached from the parent
8 const serverProcess = spawn('npx', ['kill-port', '9000'], {
9 // Detach the process so it runs independently
10 detached: true,
11 // Pipe stdout/stderr to files or ignore them
12 stdio: 'ignore',
13 shell: process.platform === 'win32',
14 });
15
16 // Unref the process so it won't keep the parent alive
17 serverProcess.unref();
18 spinner.stop('AI server stopped.');
19}

Callers 1

index.tsFile · 0.90

Calls 1

startMethod · 0.45

Tested by

no test coverage detected