From 8482d7ceeadd5d15d5a9ef6a0221c89d09295c79 Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 1 Jan 2024 15:32:42 -0300 Subject: [PATCH] scrap: trackear proceso zstd --- scraper/scrap.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scraper/scrap.ts b/scraper/scrap.ts index 1251ea1..dc5f4df 100644 --- a/scraper/scrap.ts +++ b/scraper/scrap.ts @@ -37,9 +37,8 @@ export async function parseWarc(path: string) { errors: { error: any; warcRecordId: string; path: string }[]; } = { done: 0, errors: [] }; - const warc = Bun.spawn(["zstd", "-do", "/dev/stdout", path], { - stderr: "ignore", - }).stdout; + const proc = Bun.spawn(["zstdcat", "-d", path], {}); + const warc = proc.stdout; // TODO: tirar error si falla zstd const parser = new WARCParser(warc); @@ -99,5 +98,9 @@ export async function parseWarc(path: string) { } } + if ((await proc.exited) !== 0) { + throw new Error("zstd tirĂ³ un error"); + } + return progress; }