MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / killTree

Function killTree

scripts/guardian/shared.ts:235–242  ·  view source on GitHub ↗
(child: ChildProcess, signal: NodeJS.Signals = 'SIGTERM')

Source from the content-addressed store, hash-verified

233 * keeps graceful SIGTERM (which taskkill /F can't offer anyway).
234 */
235export function killTree(child: ChildProcess, signal: NodeJS.Signals = 'SIGTERM'): void {
236 if (child.pid == null) return
237 if (process.platform === 'win32') {
238 try { spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F']) } catch { /* already gone */ }
239 } else {
240 try { child.kill(signal) } catch { /* already gone */ }
241 }
242}
243
244function writePrefixed(stream: NodeJS.WriteStream, buf: Buffer, tag: string): void {
245 const lines = buf.toString('utf8').split('\n')

Callers 2

shutdownFunction · 0.70
restartMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected