fix(desktop): unlink destination before copying binaries (#10705)

This commit is contained in:
Vincenzo Palazzo
2026-07-31 17:18:41 +02:00
committed by GitHub
parent 3016108fa6
commit b6db6a163f
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -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}`);
}