Skip to content

Commit 83a083d

Browse files
committed
fix: try @lydell/node-pty first for SSH terminals
node-pty as an optional dependency may install without being built, causing require() to succeed but spawn() to fail with 'posix_spawnp failed'. @lydell/node-pty has prebuilt binaries that work reliably in server mode.
1 parent 8d5d74d commit 83a083d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/node/services/ptyService.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,19 @@ export class PTYService {
219219
log.info(`[PTY] SSH terminal size: ${params.cols}x${params.rows}`);
220220

221221
// Load node-pty or @lydell/node-pty dynamically
222-
// Try @lydell/node-pty first (server mode), fall back to node-pty (desktop)
222+
// Try @lydell/node-pty first (server mode - always works with prebuilds)
223+
// Fall back to node-pty (desktop mode after electron-rebuild)
223224
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
224225
let pty: typeof import("node-pty");
225226
try {
226227
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment
227-
pty = require("node-pty");
228-
log.debug("Using node-pty for SSH (rebuilt for Electron)");
228+
pty = require("@lydell/node-pty");
229+
log.debug("Using @lydell/node-pty for SSH (prebuilt binaries)");
229230
} catch {
230231
try {
231232
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment
232-
pty = require("@lydell/node-pty");
233-
log.debug("Using @lydell/node-pty for SSH (prebuilt binaries)");
233+
pty = require("node-pty");
234+
log.debug("Using node-pty for SSH (rebuilt for Electron)");
234235
} catch (err) {
235236
log.error("Neither @lydell/node-pty nor node-pty available:", err);
236237
throw new Error(

0 commit comments

Comments
 (0)