From 54ec49d8b0998ef933d51bce099566929944d3b1 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Mon, 19 Oct 2026 15:58:57 +0400 Subject: [PATCH] fix: e2e sidecar copy --- e2e/run.mjs | 11 +++++++++-- src-tauri/copy-proxy-binary.mjs | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/run.mjs b/e2e/run.mjs index 1839f971..615c23eb 100644 --- a/e2e/run.mjs +++ b/e2e/run.mjs @@ -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, ); } } diff --git a/src-tauri/copy-proxy-binary.mjs b/src-tauri/copy-proxy-binary.mjs index 8fa2def1..5515cff0 100644 --- a/src-tauri/copy-proxy-binary.mjs +++ b/src-tauri/copy-proxy-binary.mjs @@ -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}`); }