Skip to content

Commit c131dd0

Browse files
authored
fix(desktop): Windows support for PTY and cross-platform build scripts (#6508)
1 parent 1c25f1f commit c131dd0

File tree

4 files changed

+5
-24
lines changed

4 files changed

+5
-24
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/desktop/scripts/predev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const RUST_TARGET = Bun.env.TAURI_ENV_TARGET_TRIPLE
66

77
const sidecarConfig = getCurrentSidecar(RUST_TARGET)
88

9-
const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode`
9+
const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode${process.platform === "win32" ? ".exe" : ""}`
1010

1111
await $`cd ../opencode && bun run build --single`
1212

packages/opencode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@zip.js/zip.js": "2.7.62",
9090
"ai": "catalog:",
9191
"bonjour-service": "1.3.0",
92-
"bun-pty": "0.4.2",
92+
"bun-pty": "0.4.4",
9393
"chokidar": "4.0.3",
9494
"clipboardy": "4.0.0",
9595
"decimal.js": "10.5.0",

packages/opencode/src/pty/index.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,12 @@ import { Log } from "../util/log"
77
import type { WSContext } from "hono/ws"
88
import { Instance } from "../project/instance"
99
import { lazy } from "@opencode-ai/util/lazy"
10-
import {} from "process"
11-
import { Installation } from "@/installation"
1210
import { Shell } from "@/shell/shell"
1311

1412
export namespace Pty {
1513
const log = Log.create({ service: "pty" })
1614

1715
const pty = lazy(async () => {
18-
if (!Installation.isLocal()) {
19-
const path = require(
20-
`bun-pty/rust-pty/target/release/${
21-
process.platform === "win32"
22-
? "rust_pty.dll"
23-
: process.platform === "linux" && process.arch === "x64"
24-
? "librust_pty.so"
25-
: process.platform === "darwin" && process.arch === "x64"
26-
? "librust_pty.dylib"
27-
: process.platform === "darwin" && process.arch === "arm64"
28-
? "librust_pty_arm64.dylib"
29-
: process.platform === "linux" && process.arch === "arm64"
30-
? "librust_pty_arm64.so"
31-
: ""
32-
}`,
33-
)
34-
process.env.BUN_PTY_LIB = path
35-
}
3616
const { spawn } = await import("bun-pty")
3717
return spawn
3818
})
@@ -128,6 +108,7 @@ export namespace Pty {
128108
cwd,
129109
env,
130110
})
111+
131112
const info = {
132113
id,
133114
title: input.title || `Terminal ${id.slice(-4)}`,

0 commit comments

Comments
 (0)