Zieht das JSON-Ergebnis des Gates aus dessen Ausgabe (letzte JSON-Zeile).
(output)
| 100 | |
| 101 | /** Zieht das JSON-Ergebnis des Gates aus dessen Ausgabe (letzte JSON-Zeile). */ |
| 102 | function parseGateReport(output) { |
| 103 | const lines = stripAnsi(output).split('\n'); |
| 104 | for (let i = lines.length - 1; i >= 0; i -= 1) { |
| 105 | const line = lines[i].trim(); |
| 106 | if (!line.startsWith('{') || !line.endsWith('}')) { continue; } |
| 107 | try { |
| 108 | return JSON.parse(line); |
| 109 | } catch { |
| 110 | // war doch kein Report |
| 111 | } |
| 112 | } |
| 113 | return null; |
| 114 | } |
| 115 | |
| 116 | async function main() { |
| 117 | await mkdir(OUT_DIR, { recursive: true }); |