( markerPath: string, owned: OwnedChild, timeoutMs: number, )
| 387 | }; |
| 388 | |
| 389 | const waitForMarker = async ( |
| 390 | markerPath: string, |
| 391 | owned: OwnedChild, |
| 392 | timeoutMs: number, |
| 393 | ): Promise<ChildCloseResult> => { |
| 394 | const deadline = Date.now() + timeoutMs; |
| 395 | while (Date.now() < deadline) { |
| 396 | if (existsSync(markerPath)) { |
| 397 | return { |
| 398 | markerFound: true, |
| 399 | exitCode: owned.child.exitCode, |
| 400 | signalCode: owned.child.signalCode, |
| 401 | }; |
| 402 | } |
| 403 | if (owned.child.exitCode !== null || owned.child.signalCode !== null) { |
| 404 | return { |
| 405 | markerFound: false, |
| 406 | exitCode: owned.child.exitCode, |
| 407 | signalCode: owned.child.signalCode, |
| 408 | }; |
| 409 | } |
| 410 | await delay(25); |
| 411 | } |
| 412 | return { markerFound: false, exitCode: owned.child.exitCode, signalCode: owned.child.signalCode }; |
| 413 | }; |
| 414 | |
| 415 | const waitForChildClose = async (owned: OwnedChild, timeoutMs: number): Promise<void> => |
| 416 | new Promise((resolve) => { |
no test coverage detected