Address EXDEV issue

This commit is contained in:
Michael B. Gale
2026-10-12 16:37:06 +01:00
parent 33049e1967
commit 6964da9adb
3 changed files with 46 additions and 5 deletions

15
lib/entry-points.js generated
View File

@@ -170021,6 +170021,9 @@ function wrapError(error3) {
function getErrorMessage(error3) {
return error3 instanceof Error ? error3.message : String(error3);
}
function isErrnoException(error3) {
return typeof error3 === "object" && error3 !== null && "code" in error3 && typeof error3.code === "string";
}
function prettyPrintPack(pack) {
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`;
}
@@ -173099,10 +173102,18 @@ function flushDiagnostics(action, config) {
const destination = import_path2.default.join(directory, filename);
try {
fs7.mkdirSync(directory, { recursive: true });
fs7.renameSync(temporary.path, destination);
try {
fs7.renameSync(temporary.path, destination);
} catch (renameErr) {
if (!isErrnoException(renameErr) || renameErr.code !== "EXDEV") {
throw renameErr;
}
fs7.copyFileSync(temporary.path, destination);
fs7.unlinkSync(temporary.path);
}
} catch (err) {
action.logger.warning(
`Failed to rename '${temporary.path}' to '${destination}': ${getErrorMessage(err)}`
`Failed to relocate '${temporary.path}' to '${destination}': ${getErrorMessage(err)}`
);
failedFlushDiagnostics.push(temporary);
}