Skip to content

Commit

Permalink
module: add report tar debug information (#610)
Browse files Browse the repository at this point in the history
* module: add report tar debug information

filecoin-station/zinnia#485 (comment)

* clean up

* explicit
  • Loading branch information
juliangruber authored Oct 12, 2024
1 parent 29579ea commit 35cae21
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export async function updateSourceFiles ({
}
}

const tarExtractWarnings = []
const tarExtractEntries = []
try {
const reader = await CarReader.fromIterable(res.body)
const entries = exporter(cid, {
Expand All @@ -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 {
Expand All @@ -227,6 +239,8 @@ export async function updateSourceFiles ({
throw err
}
}
err.tarExtractWarnings = tarExtractWarnings
err.tarExtractEntries = tarExtractEntries
throw err
}

Expand Down

0 comments on commit 35cae21

Please sign in to comment.