Repository navigation
Conversation
|
I encountered the same issue. Thank you very much, your code solved it~ |
Co-authored-by: Cursor <cursoragent@cursor.com>
samwei12
force-pushed
the
fix/runtime-spawn-helper-permissions
branch
from
October 28, 2026 11:32
29adb2e to
9dae8e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On macOS, new terminal sessions disconnect immediately after the plugin is installed, because
node-ptycannot spawn itsspawn-helper. This restores the execute bit on the helper of thenode-ptycopy the plugin actually loads.Closes #1.
Root cause
node-pty@1.1.0npm tarball shipsprebuilds/darwin-*/spawn-helperas-rw-r--r--.npm install --ignore-scripts, sonode-pty's own post-install step that sets the bit never runs.pty.spawn()then throwsposix_spawnp failed, and the websocket closes right after connecting.What changed
src/shell.ts: new side-effect-freeensureSpawnHelperExecutable(root, platform, arch). It only acts on darwin, only touches the helper for the current architecture, only adds the owner execute bit, and does nothing when the helper is absent (source build, other layouts).src/server.ts:findModule()calls it right afternode-ptyloads successfully, using the package root of the specifier that was loaded, so a host-provided copy is repaired as well. The repair is best effort and never makes the module load fail.test/shell.test.mjs: two tests covering darwin-only behaviour, current-architecture-only, idempotence, and a missing helper.Verification
npm run typecheckpasses;node --test test/shell.test.mjspasses (13 tests).npm install --ignore-scriptsand the helper left non-executable,test/server.test.mjsfails 9 tests on currentmain(every test that spawns a PTY). With this change it fails 3.init chooses the working directory…,a dropped connection keeps the shell alive…,resize reaches the PTY) also fail onmainwhen the helper is executable, so they are not caused by this change. The first compares/var/…with its/private/var/…realpath; the other two depend on how the local shell echoes input.Related: #12 addresses the same symptom with a different approach.