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. - } - } -}