mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-18 07:12:47 +03:00
fix(desktop): stage the bundled CLI per architecture (#54979)
This commit is contained in:
committed by
GitHub
Unverified
parent
67f5c2197a
commit
f7ac58f267
@@ -1,7 +1,7 @@
|
||||
import { Effect, FileSystem, Path } from "effect"
|
||||
|
||||
// Each version stages its own copy of the CLI, and only the current one is ever started again: a
|
||||
// downgrade stages its copy anew. Windows refuses to delete an executable that has not exited yet,
|
||||
// Each version and architecture stages its own copy of the CLI, and only the current one is ever started
|
||||
// again: a downgrade stages its copy anew. Windows refuses to delete an executable that has not exited yet,
|
||||
// so a failed removal is logged and retried on the next launch.
|
||||
export const cleanStages = Effect.fn("DesktopCli.cleanStages")(function* (binary: string) {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
|
||||
@@ -139,7 +139,9 @@ const ExecFailure = Schema.Struct({ stdout: Schema.optional(Schema.String), stde
|
||||
const installCli = Effect.fn("DesktopCli.install")(function* (source: string, version: string) {
|
||||
const fs = yield* FileSystem.FileSystem
|
||||
const path = yield* Path.Path
|
||||
const directory = path.join(app.getPath("userData"), "cli", version.replace(/[^a-zA-Z0-9._-]/g, "-"))
|
||||
// x64 and ARM64 installers share userData on Windows ARM64, so a same-version switch must not reuse the other copy.
|
||||
const stage = `${version}-${process.arch}`.replace(/[^a-zA-Z0-9._-]/g, "-")
|
||||
const directory = path.join(app.getPath("userData"), "cli", stage)
|
||||
const destination = path.join(directory, executableName())
|
||||
|
||||
if (existsSync(destination)) {
|
||||
|
||||
Reference in New Issue
Block a user