(child: ChildProcessWithoutNullStreams, timeoutMs: number)
| 49 | } |
| 50 | |
| 51 | function waitForExit(child: ChildProcessWithoutNullStreams, timeoutMs: number): Promise<number | null> { |
| 52 | return new Promise((resolve, reject) => { |
| 53 | if (child.exitCode !== null) { resolve(child.exitCode); return; } |
| 54 | const timer = setTimeout( |
| 55 | () => reject(new Error(`server did not exit within ${timeoutMs}ms`)), |
| 56 | timeoutMs |
| 57 | ); |
| 58 | child.on('exit', (code) => { clearTimeout(timer); resolve(code); }); |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); |
| 63 |
no test coverage detected