fix(desktop): unlink destination before copying binaries (#10705)
This commit is contained in:
@@ -106,6 +106,7 @@ ui/desktop/ # Electron app
|
||||
- Never: Skip cargo fmt
|
||||
- Never: Merge without running clippy
|
||||
- Never: Comment self-evident operations (`// Initialize`, `// Return result`), getters/setters, constructors, or standard Rust idioms
|
||||
- Never: Overwrite a live binary in place (e.g. `cp`/`fs.copyFileSync` onto an existing executable) - unlink or atomic-rename the destination first, otherwise macOS SIGKILLs running processes with "Code Signature Invalid"
|
||||
|
||||
## Entry Points
|
||||
- CLI: crates/goose-cli/src/main.rs
|
||||
|
||||
@@ -140,7 +140,9 @@ async function ensureWindowsUvBinaries() {
|
||||
);
|
||||
}
|
||||
|
||||
fs.copyFileSync(extractedPath, path.join(srcBinDir, name));
|
||||
const destPath = path.join(srcBinDir, name);
|
||||
fs.rmSync(destPath, { force: true });
|
||||
fs.copyFileSync(extractedPath, destPath);
|
||||
console.log(`Copied pinned ${name}`);
|
||||
}
|
||||
} finally {
|
||||
@@ -225,9 +227,11 @@ async function copyPlatformFiles(targetPlatform) {
|
||||
const destPath = path.join(srcBinDir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
fs.cpSync(srcPath, destPath, { recursive: true, force: true });
|
||||
fs.rmSync(destPath, { recursive: true, force: true });
|
||||
fs.cpSync(srcPath, destPath, { recursive: true });
|
||||
console.log(`Copied directory: ${file.name}`);
|
||||
} else {
|
||||
fs.rmSync(destPath, { force: true });
|
||||
fs.copyFileSync(srcPath, destPath);
|
||||
console.log(`Copied: ${file.name}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user