MCPcopy Create free account
hub / github.com/tiann/hapi / startServerAsChild

Function startServerAsChild

cli/src/utils/autoStartServer.ts:127–140  ·  view source on GitHub ↗

* Start hub as a child process (will exit when CLI exits)

()

Source from the content-addressed store, hash-verified

125 * Start hub as a child process (will exit when CLI exits)
126 */
127function startServerAsChild(): void {
128 const serverProcess = spawnHappyCLI(['hub'], {
129 detached: false,
130 stdio: 'ignore',
131 env: process.env
132 })
133
134 logger.debug(`[AUTO-START] Hub process spawned with PID ${serverProcess.pid}`)
135
136 // Ensure hub is killed when CLI exits
137 process.on('exit', () => {
138 serverProcess.kill()
139 })
140}
141
142/**
143 * Main entry point: auto-start hub if conditions are met

Callers 1

maybeAutoStartServerFunction · 0.85

Calls 3

spawnHappyCLIFunction · 0.90
debugMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected