| 60 | }; |
| 61 | |
| 62 | const getStatus = async (url: string) => { |
| 63 | return new Promise<{ body: string; status: number }>((resolve, reject) => { |
| 64 | http |
| 65 | .get(url, (response) => { |
| 66 | let body = ''; |
| 67 | response.setEncoding('utf8'); |
| 68 | response.on('data', (chunk) => { |
| 69 | body += chunk; |
| 70 | }); |
| 71 | response.on('end', () => { |
| 72 | resolve({ body, status: response.statusCode ?? 0 }); |
| 73 | }); |
| 74 | }) |
| 75 | .on('error', reject); |
| 76 | }); |
| 77 | }; |
| 78 | |
| 79 | const stopWebServer = (child: child_process.ChildProcess | undefined) => { |
| 80 | if (!child || child.killed) { |