| 71 | } |
| 72 | |
| 73 | async function stopProcess(child: import("node:child_process").ChildProcess): Promise<void> { |
| 74 | const exitPromise = new Promise<void>((resolve, reject) => { |
| 75 | child.once("exit", () => resolve()); |
| 76 | child.once("error", reject); |
| 77 | }); |
| 78 | |
| 79 | child.kill("SIGTERM"); |
| 80 | |
| 81 | const timeoutPromise = new Promise<never>((_, reject) => { |
| 82 | setTimeout(() => reject(new Error("installed CLI did not stop after SIGTERM")), 10000); |
| 83 | }); |
| 84 | |
| 85 | await Promise.race([exitPromise, timeoutPromise]); |
| 86 | } |
| 87 | |
| 88 | async function main(): Promise<void> { |
| 89 | const projectRoot = process.cwd(); |