fix: e2e sidecar copy

This commit is contained in:
zhom committed 2026-10-19 15:58:57 +04:00
1 parent 99414bdcc4
commit 54ec49d8b0
2 files changed
+12 -3

No files matched your search

+9 -2
View File
@@ -7,6 +7,7 @@ import {
createWriteStream,
existsSync,
readFileSync,
rmSync,
statSync,
} from "node:fs";
import {
@@ -316,10 +317,16 @@ function syncHarnessLockfile() {
// Tauri starts a sidecar from next to the running executable only. Copy the
// sidecars this build made there, so a copy left by an older harness never
// fails every launch on its version check.
// fails every launch on its version check. The old file is removed first:
// macOS kills an executable that was overwritten in place.
function installSidecars() {
const target = hostRustTarget();
for (const name of ["donut-proxy", "xray"]) {
const destination = path.join(
path.dirname(appBinary),
`${name}${executableSuffix}`,
);
rmSync(destination, { force: true });
copyFileSync(
path.join(
projectRoot,
@@ -327,7 +334,7 @@ function installSidecars() {
"binaries",
`${name}-${target}${executableSuffix}`,
),
path.join(path.dirname(appBinary), `${name}${executableSuffix}`),
destination,
);
}
}
+3 -1
View File
@@ -1,5 +1,5 @@
import { execFileSync, execSync } from "node:child_process";
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
import { copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { downloadXray } from "./download-xray.mjs";
@@ -75,6 +75,8 @@ function copyBinary(baseName) {
console.error(`Error: Failed to build ${baseName} binary`);
process.exit(1);
}
// macOS kills an executable that was overwritten in place.
rmSync(dest, { force: true });
copyFileSync(source, dest);
console.log(`Built and copied ${binName} to ${dest}`);
}