From 35cae218b06bede61e5ee44700941023ee73973d Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Sat, 12 Oct 2024 12:13:11 +0200 Subject: [PATCH] module: add report tar debug information (#610) * module: add report tar debug information https://github.com/filecoin-station/zinnia/issues/485#issuecomment-2406646096 * clean up * explicit --- lib/modules.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/modules.js b/lib/modules.js index de894f34..a47bc96a 100644 --- a/lib/modules.js +++ b/lib/modules.js @@ -192,6 +192,8 @@ export async function updateSourceFiles ({ } } + const tarExtractWarnings = [] + const tarExtractEntries = [] try { const reader = await CarReader.fromIterable(res.body) const entries = exporter(cid, { @@ -216,8 +218,18 @@ export async function updateSourceFiles ({ // `{ strip: 1 }` tells tar to remove the top-level directory (e.g. `mod-peer-checker-v1.0.0`) await pipeline( /** @type {any} */(entry.content()), - /** @type {any} */(tar.x({ strip: 1, C: outDir })) + /** @type {any} */(tar.x({ + strip: 1, + C: outDir, + onwarn (code, message, data) { + tarExtractWarnings.push({ code, message, data }) + }, + onReadEntry (entry) { + tarExtractEntries.push(entry.path) + } + })) ) + await stat(join(outDir, 'main.js')) } } catch (err) { try { @@ -227,6 +239,8 @@ export async function updateSourceFiles ({ throw err } } + err.tarExtractWarnings = tarExtractWarnings + err.tarExtractEntries = tarExtractEntries throw err }