mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: invalid cross-device link (#54)
* fix: invalid cross-device link * version flag fix in workflow * remove version from package.json
This commit is contained in:
+12
-2
@@ -192,8 +192,18 @@ async function install() {
|
||||
);
|
||||
}
|
||||
|
||||
// Move binary to final location
|
||||
fs.renameSync(extractedBinaryPath, finalBinaryPath);
|
||||
// Move binary to final location (handle cross-device links)
|
||||
try {
|
||||
fs.renameSync(extractedBinaryPath, finalBinaryPath);
|
||||
} catch (error) {
|
||||
if (error.code === "EXDEV") {
|
||||
// Cross-device link not permitted, copy and delete instead
|
||||
fs.copyFileSync(extractedBinaryPath, finalBinaryPath);
|
||||
fs.unlinkSync(extractedBinaryPath);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Make executable on Unix systems
|
||||
if (process.platform !== "win32") {
|
||||
|
||||
Reference in New Issue
Block a user