mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
refactor(core): type native PTY import explicitly (#45710)
This commit is contained in:
committed by
GitHub
Unverified
parent
43c8690c14
commit
d34dd6c14a
@@ -1,14 +1,15 @@
|
||||
import { createRequire } from "node:module"
|
||||
import { isSea } from "node:sea"
|
||||
import type { spawn } from "@lydell/node-pty"
|
||||
import type { Opts, Proc } from "./pty.js"
|
||||
|
||||
export type { Disp, Exit, Opts, Proc } from "./pty.js"
|
||||
|
||||
const pty = createRequire(import.meta.url)(
|
||||
process.env.OPENCODE_NODE_PTY_PATH ?? "@lydell/node-pty",
|
||||
) as typeof import("@lydell/node-pty")
|
||||
const pty = createRequire(import.meta.url)(process.env.OPENCODE_NODE_PTY_PATH ?? "@lydell/node-pty") as {
|
||||
spawn: typeof spawn
|
||||
}
|
||||
|
||||
export function spawn(file: string, args: string[], opts: Opts): Proc {
|
||||
function spawnPty(file: string, args: string[], opts: Opts): Proc {
|
||||
const proc = pty.spawn(file, args, process.platform === "win32" && isSea() ? { ...opts, useConptyDll: true } : opts)
|
||||
return {
|
||||
pid: proc.pid,
|
||||
@@ -29,3 +30,5 @@ export function spawn(file: string, args: string[], opts: Opts): Proc {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export { spawnPty as spawn }
|
||||
|
||||
Reference in New Issue
Block a user