( output: ChildOutput, timeoutMs: number, )
| 87 | }; |
| 88 | |
| 89 | const waitForChildClose = async ( |
| 90 | output: ChildOutput, |
| 91 | timeoutMs: number, |
| 92 | ): Promise<ChildCloseResult> => |
| 93 | new Promise((resolve) => { |
| 94 | const complete = (timedOut: boolean) => { |
| 95 | clearTimeout(timer); |
| 96 | output.child.off("close", onClose); |
| 97 | resolve({ |
| 98 | timedOut, |
| 99 | exitCode: output.child.exitCode, |
| 100 | signalCode: output.child.signalCode, |
| 101 | stdout: output.stdout.trim(), |
| 102 | stderr: output.stderr.trim(), |
| 103 | }); |
| 104 | }; |
| 105 | const onClose = () => complete(false); |
| 106 | const timer = setTimeout(() => complete(true), timeoutMs); |
| 107 | |
| 108 | if (output.child.exitCode !== null || output.child.signalCode !== null) { |
| 109 | complete(false); |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | output.child.once("close", onClose); |
| 114 | }); |
| 115 | |
| 116 | const waitForMarker = async ( |
| 117 | markerPath: string, |
no test coverage detected