fix(run): switch node-pty to @lydell/node-pty for the plugin's --ignore-scripts install path
node-pty ships prebuilt binaries for darwin/win32 only — on Linux it needs a native build via its install script. The plugin's --ignore-scripts install (scripts/plugin-bootstrap.js, deliberately skipped to avoid requiring a build toolchain) silently left node-pty unusable: server/lib/pty-attach.js's require() threw "Cannot find module './prebuilds/linux-x64//pty.node'" the moment a terminal was attached, leaving TerminalView permanently blank with no visible error. @lydell/node-pty is an API-compatible fork that ships each platform's binary as a regular optionalDependency instead of a postinstall build step, so a plain --ignore-scripts install resolves a working native binding on Linux with no compiler needed. Verified by installing with the exact `npm install --omit=dev --ignore-scripts` invocation the plugin bootstrap uses and confirming require() succeeds.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file pty-attach.js
|
||||
* @description Bridges one WebSocket connection to a `node-pty`-backed
|
||||
* @description Bridges one WebSocket connection to an `@lydell/node-pty`-backed
|
||||
* `tmux attach-session` process. Binary WS frames carry raw PTY bytes in
|
||||
* both directions; text WS frames carry small JSON control messages
|
||||
* (`resize`, and an outbound `exit` sent once when the pane process/tmux
|
||||
@@ -98,7 +98,15 @@ function attach(ws, runId, { cols, rows }) {
|
||||
}
|
||||
|
||||
// Real spawn implementation — lazy-required so unit tests never load the
|
||||
// native node-pty addon unless they explicitly opt in.
|
||||
__setSpawnImpl((...args) => require("node-pty").spawn(...args));
|
||||
// native PTY addon unless they explicitly opt in. Uses @lydell/node-pty (a
|
||||
// drop-in-API-compatible fork of node-pty) rather than node-pty itself:
|
||||
// node-pty ships prebuilt binaries for darwin/win32 only, so on Linux it
|
||||
// needs a native build via its install script — but the plugin install path
|
||||
// runs `npm install --ignore-scripts` deliberately (see plugin-bootstrap.js)
|
||||
// to avoid requiring a build toolchain on the user's machine. @lydell/node-pty
|
||||
// instead ships the platform binary as a regular optionalDependency
|
||||
// (@lydell/node-pty-linux-x64 etc.), so a plain --ignore-scripts install still
|
||||
// resolves a working native binding with no compiler needed.
|
||||
__setSpawnImpl((...args) => require("@lydell/node-pty").spawn(...args));
|
||||
|
||||
module.exports = { attach, validateRunId, __setSpawnImpl };
|
||||
|
||||
Reference in New Issue
Block a user