( origin: string, token: string | undefined, )
| 134 | |
| 135 | /** POST the shutdown endpoint; resolves once the request completes or times out. */ |
| 136 | export async function requestShutdownViaApi( |
| 137 | origin: string, |
| 138 | token: string | undefined, |
| 139 | ): Promise<void> { |
| 140 | const controller = new AbortController(); |
| 141 | const timeout = setTimeout(() => { |
| 142 | controller.abort(); |
| 143 | }, API_TIMEOUT_MS); |
| 144 | try { |
| 145 | await fetch(`${origin}/api/v1/shutdown`, { |
| 146 | method: 'POST', |
| 147 | headers: token !== undefined ? authHeaders(token) : undefined, |
| 148 | signal: controller.signal, |
| 149 | }); |
| 150 | } finally { |
| 151 | clearTimeout(timeout); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | const DEFAULT_KILL_DEPS: KillCommandDeps = { |
| 156 | getLiveLock, |
nothing calls this directly
no test coverage detected