Files
rea/tests/fixtures/directoryReaderUnsupportedEntryProbe.mjs
morluto 5502ca9c97 fix(artifacts): retain reader owners after cleanup failures
Keep directory handles under explicit close ownership and retain ZIP and Mach-O admission owners when initialization or cleanup fails. Preserve cancellation and primary failure details, and avoid false successful release after native handle invalidation.

Validation: filesystem ownership, FIFO, archive and reconstruction boundary checks; static and architecture checks; real macOS CLI/MCP bundle workflows. Windows native behavior was not verified.
2026-10-11 05:33:05 +08:00

16 lines
533 B
JavaScript

import { pathToFileURL } from "node:url";
const [modulePath, root] = process.argv.slice(2);
if (modulePath === undefined || root === undefined)
throw new Error("Directory reader probe requires module and root paths");
const { DirectoryArtifactReader } = await import(pathToFileURL(modulePath));
const reader = new DirectoryArtifactReader(root);
const paths = [];
try {
for await (const entry of reader.entries()) paths.push(entry.path);
} finally {
await reader.close();
}
process.stdout.write(`${JSON.stringify(paths)}\n`);