()
| 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…') |
no outgoing calls
no test coverage detected