소스 검색

do not use required pty for local dev

Dax Raad 2 달 전
부모
커밋
60388f7f03
1개의 변경된 파일19개의 추가작업 그리고 16개의 파일을 삭제
  1. 19 16
      packages/opencode/src/pty/index.ts

+ 19 - 16
packages/opencode/src/pty/index.ts

@@ -8,27 +8,30 @@ import { Instance } from "../project/instance"
 import { shell } from "@opencode-ai/util/shell"
 import { lazy } from "@opencode-ai/util/lazy"
 import {} from "process"
+import { Installation } from "@/installation"
 
 export namespace Pty {
   const log = Log.create({ service: "pty" })
 
   const pty = lazy(async () => {
-    const path = require(
-      `bun-pty/rust-pty/target/release/${
-        process.platform === "win32"
-          ? "rust_pty.dll"
-          : process.platform === "linux" && process.arch === "x64"
-            ? "librust_pty.so"
-            : process.platform === "darwin" && process.arch === "x64"
-              ? "librust_pty.dylib"
-              : process.platform === "darwin" && process.arch === "arm64"
-                ? "librust_pty_arm64.dylib"
-                : process.platform === "linux" && process.arch === "arm64"
-                  ? "librust_pty_arm64.so"
-                  : ""
-      }`,
-    )
-    process.env.BUN_PTY_LIB = path
+    if (!Installation.isLocal()) {
+      const path = require(
+        `bun-pty/rust-pty/target/release/${
+          process.platform === "win32"
+            ? "rust_pty.dll"
+            : process.platform === "linux" && process.arch === "x64"
+              ? "librust_pty.so"
+              : process.platform === "darwin" && process.arch === "x64"
+                ? "librust_pty.dylib"
+                : process.platform === "darwin" && process.arch === "arm64"
+                  ? "librust_pty_arm64.dylib"
+                  : process.platform === "linux" && process.arch === "arm64"
+                    ? "librust_pty_arm64.so"
+                    : ""
+        }`,
+      )
+      process.env.BUN_PTY_LIB = path
+    }
     const { spawn } = await import("bun-pty")
     return spawn
   })