mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
perf(desktop): load node-pty when an interactive WSL install starts (#49789)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { spawn } from "node:child_process"
|
||||
import * as pty from "@lydell/node-pty"
|
||||
import type { WslDistroProbe, WslInstalledDistro, WslOnlineDistro, WslRuntimeCheck } from "@opencode/app/wsl/types"
|
||||
import { Effect, FileSystem, Path } from "effect"
|
||||
import { nativeT } from "../native/translations"
|
||||
@@ -117,7 +116,14 @@ function runCommand(command: string, args: string[], opts: RunWslOptions = {}) {
|
||||
})
|
||||
}
|
||||
|
||||
function runInteractiveCommand(command: string, args: string[], opts: RunWslOptions = {}, defaultTimeoutMs: number) {
|
||||
async function runInteractiveCommand(
|
||||
command: string,
|
||||
args: string[],
|
||||
opts: RunWslOptions = {},
|
||||
defaultTimeoutMs: number,
|
||||
) {
|
||||
// The native addon is only needed for interactive installs; loading it here keeps it out of startup.
|
||||
const pty = await import("@lydell/node-pty")
|
||||
return new Promise<WslCommandResult>((resolve, reject) => {
|
||||
const child = pty.spawn(command, args, {
|
||||
name: "xterm-color",
|
||||
|
||||
Reference in New Issue
Block a user