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:
@@ -93,5 +93,5 @@ jobs:
|
|||||||
- name: Test installation
|
- name: Test installation
|
||||||
run: |
|
run: |
|
||||||
npm install -g @safedep/pmg@${{ steps.version.outputs.version }}
|
npm install -g @safedep/pmg@${{ steps.version.outputs.version }}
|
||||||
pmg --version
|
pmg version
|
||||||
pmg --help || true
|
pmg --help || true
|
||||||
|
|||||||
+12
-2
@@ -192,8 +192,18 @@ async function install() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move binary to final location
|
// Move binary to final location (handle cross-device links)
|
||||||
fs.renameSync(extractedBinaryPath, finalBinaryPath);
|
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
|
// Make executable on Unix systems
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
|
|||||||
Reference in New Issue
Block a user