fix: preserve archive on unlink failure
This commit is contained in:
@@ -33,8 +33,10 @@ export async function archiveManifest({ root = process.cwd(), network, now = new
|
||||
try {
|
||||
await operations.rm(source);
|
||||
} catch (error) {
|
||||
await operations.rm(target, { force: true }).catch(() => {});
|
||||
throw error;
|
||||
throw new Error(
|
||||
`archive created at ${target}, but source ${source} could not be removed; both paths were preserved: ${error.message}`,
|
||||
{ cause: error },
|
||||
);
|
||||
}
|
||||
return { source, path: target };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user