(info: ServerInfo)
| 102 | * Stop the deepnote-toolkit server. |
| 103 | */ |
| 104 | export async function stopServer(info: ServerInfo): Promise<void> { |
| 105 | if (info.process.exitCode !== null) return |
| 106 | |
| 107 | // Try graceful shutdown first |
| 108 | info.process.kill('SIGTERM') |
| 109 | |
| 110 | // Wait briefly for graceful exit |
| 111 | await new Promise<void>(resolve => { |
| 112 | const timeout = setTimeout(() => { |
| 113 | if (info.process.exitCode === null) { |
| 114 | info.process.kill('SIGKILL') |
| 115 | } |
| 116 | void resolve() |
| 117 | }, 2000) |
| 118 | |
| 119 | info.process.once('exit', () => { |
| 120 | clearTimeout(timeout) |
| 121 | void resolve() |
| 122 | }) |
| 123 | }) |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Find two consecutive available ports starting from the given port. |
no outgoing calls
no test coverage detected