()
| 337 | writeState(state); |
| 338 | |
| 339 | const shutdown = async () => { |
| 340 | await teardown(); |
| 341 | if (state.servePorts) { |
| 342 | const ts = await findTailscale(); |
| 343 | if (ts) { |
| 344 | for (const port of state.servePorts) await sh(ts, ["serve", `--https=${port}`, "off"]); |
| 345 | } |
| 346 | } |
| 347 | rmSync(statePath(target), { force: true }); |
| 348 | process.exit(0); |
| 349 | }; |
| 350 | process.on("SIGTERM", () => void shutdown()); |
| 351 | process.on("SIGINT", () => void shutdown()); |
| 352 | // Stay alive: this process owns the instance (and cloud's emulators). |
no test coverage detected