(owned: OwnedChild, timeoutMs: number)
| 413 | }; |
| 414 | |
| 415 | const waitForChildClose = async (owned: OwnedChild, timeoutMs: number): Promise<void> => |
| 416 | new Promise((resolve) => { |
| 417 | if (owned.child.exitCode !== null || owned.child.signalCode !== null) { |
| 418 | resolve(); |
| 419 | return; |
| 420 | } |
| 421 | const timer = setTimeout(() => { |
| 422 | owned.child.off("close", onClose); |
| 423 | resolve(); |
| 424 | }, timeoutMs); |
| 425 | const onClose = () => { |
| 426 | clearTimeout(timer); |
| 427 | resolve(); |
| 428 | }; |
| 429 | owned.child.once("close", onClose); |
| 430 | }); |
no test coverage detected