MCPcopy
hub / github.com/lightningpixel/modly / stop

Method stop

electron/main/python-bridge.ts:104–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102 }
103
104 async stop(): Promise<void> {
105 if (!this.process) return
106 const proc = this.process
107 this.process = null
108 this.ready = false
109 if (process.platform === 'win32') {
110 const { execSync } = require('child_process')
111 try { execSync(`taskkill /PID ${proc.pid} /T /F`) } catch {}
112 } else if (proc.pid) {
113 // Kill the entire process group (negative PID) so extension subprocesses
114 // die with the bridge instead of being orphaned to launchd. SIGKILL
115 // rather than SIGTERM: on app quit we want immediate release of Metal
116 // wired memory, not a polite request the subprocess might ignore while
117 // it finishes an operation.
118 try {
119 process.kill(-proc.pid, 'SIGKILL')
120 } catch {
121 try { proc.kill('SIGKILL') } catch {}
122 }
123 }
124 console.log('[PythonBridge] Stopped')
125 }
126
127 async restart(): Promise<void> {
128 console.log('[PythonBridge] Restarting to free memory…')

Callers 3

restartMethod · 0.95
index.tsFile · 0.45
SplatViewer.tsxFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected