From 3b8b46716b0cb6bdd21e92f1b1a4e1e3bc9e1f76 Mon Sep 17 00:00:00 2001 From: akougkas Date: Sat, 25 Apr 2026 07:28:46 -0500 Subject: [PATCH] chore: drop the node-pty postinstall hook and helper script Removes scripts/fix-node-pty-permissions.mjs and the matching postinstall entry from package.json. CI is Ubuntu-only; the macOS spawn-helper bit is never read by any automated path. The hook was solving a problem the deleted cross-platform CI introduced, not a real one. --- package.json | 1 - scripts/fix-node-pty-permissions.mjs | 39 ---------------------------- 2 files changed, 40 deletions(-) delete mode 100644 scripts/fix-node-pty-permissions.mjs diff --git a/package.json b/package.json index 5882b36..0805b20 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,6 @@ "test:e2e": "npm run build && node --import tsx --test 'tests/e2e/**/*.test.ts'", "ci": "npm run typecheck && npm run lint && npm run test && npm run build && npm run test:e2e", "hooks:install": "bash scripts/install-hooks.sh", - "postinstall": "node scripts/fix-node-pty-permissions.mjs", "prepublishOnly": "npm run typecheck && npm run lint && npm run build && node scripts/check-dist.mjs" }, "dependencies": { diff --git a/scripts/fix-node-pty-permissions.mjs b/scripts/fix-node-pty-permissions.mjs deleted file mode 100644 index 96be1c0..0000000 --- a/scripts/fix-node-pty-permissions.mjs +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env node -// node-pty 1.1.0's published tarball ships prebuilds/-/spawn-helper -// without the executable bit on macOS targets. Without exec, posix_spawnp from -// the native binding fails with "posix_spawnp failed" the first time the pty -// harness tries to fork a subprocess. Linux dodges this because no Linux -// prebuild exists; node-gyp recompiles the helper, and the compiler emits an -// executable. Windows uses winpty/conpty and never touches spawn-helper. -// -// Idempotent and defensive: we never let postinstall fail. -import { chmodSync, existsSync } from "node:fs"; -import { createRequire } from "node:module"; -import { dirname, join } from "node:path"; - -const require = createRequire(import.meta.url); - -let ptyDir; -try { - ptyDir = dirname(require.resolve("node-pty/package.json")); -} catch { - process.exit(0); -} - -const candidates = [ - ["darwin", "arm64"], - ["darwin", "x64"], - ["linux", "x64"], - ["linux", "arm64"], -]; - -for (const [platform, arch] of candidates) { - const helper = join(ptyDir, "prebuilds", `${platform}-${arch}`, "spawn-helper"); - if (existsSync(helper)) { - try { - chmodSync(helper, 0o755); - } catch { - // ignore; postinstall must not fail. - } - } -}