()
| 212 | * manager. Returns the zip path. |
| 213 | */ |
| 214 | export const exportDiagnostics = async (): Promise<string> => { |
| 215 | const { TextReader, Uint8ArrayReader, Uint8ArrayWriter, ZipWriter } = |
| 216 | await import("@zip.js/zip.js"); |
| 217 | const { readFile } = await import("node:fs/promises"); |
| 218 | |
| 219 | const logsDir = dirname(log.transports.file.getFile().path); |
| 220 | const executorLogsDir = join(app.getPath("home"), ".executor", "logs"); |
| 221 | const entries: ZipEntry[] = [ |
| 222 | ...collectFiles(logsDir, "logs"), |
| 223 | ...collectFiles(executorLogsDir, "executor-logs"), |
| 224 | ...collectFiles(app.getPath("crashDumps"), "crash-dumps"), |
| 225 | ]; |
| 226 | |
| 227 | const writer = new ZipWriter(new Uint8ArrayWriter()); |
| 228 | await writer.add("manifest.json", new TextReader(JSON.stringify(buildManifest(), null, 2))); |
| 229 | for (const entry of entries) { |
| 230 | await writer.add(entry.name, new Uint8ArrayReader(new Uint8Array(await readFile(entry.path)))); |
| 231 | } |
| 232 | const zipped = await writer.close(); |
| 233 | |
| 234 | const output = join(app.getPath("downloads"), `executor-diagnostics-${exportStamp()}.zip`); |
| 235 | writeFileSync(output, zipped); |
| 236 | log.info("[diagnostics] exported", { output, files: entries.length }); |
| 237 | shell.showItemInFolder(output); |
| 238 | return output; |
| 239 | }; |
| 240 | |
| 241 | /** |
| 242 | * "Report a Problem…" menu flow: export the diagnostics zip, then open a |
no test coverage detected