From 971f4e558ef046382f882fb9014c9e1e958fd2c1 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Sat, 19 Sep 2026 10:34:44 +1000 Subject: [PATCH] perf(desktop): load node-pty when an interactive WSL install starts (#49789) --- packages/desktop/src/main/wsl/runtime.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/desktop/src/main/wsl/runtime.ts b/packages/desktop/src/main/wsl/runtime.ts index 7ac5c5b9268..78f17503a5b 100644 --- a/packages/desktop/src/main/wsl/runtime.ts +++ b/packages/desktop/src/main/wsl/runtime.ts @@ -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((resolve, reject) => { const child = pty.spawn(command, args, { name: "xterm-color",