-
-
Notifications
You must be signed in to change notification settings - Fork 195
Expand file tree
/
Copy pathpostinstall.js
More file actions
24 lines (23 loc) · 918 Bytes
/
postinstall.js
File metadata and controls
24 lines (23 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require("fs");
const path = require("path");
// Workaround for node-pty #850: spawn-helper ships without +x in npm tarball.
// Fixed in node-pty >=1.2.0; remove this script once we upgrade.
if (process.platform === "darwin") {
const candidates = ["darwin-arm64", "darwin-x64"];
for (const dir of candidates) {
const helperPath = path.join(
__dirname, "node_modules", "node-pty",
"prebuilds", dir, "spawn-helper"
);
try {
fs.chmodSync(helperPath, 0o755);
console.log(`postinstall: chmod 755 ${helperPath}`);
} catch (e) {
if (e.code === "ENOENT") {
console.log(`postinstall: spawn-helper not found for ${dir} (expected on other arch)`);
} else {
console.error(`postinstall: failed to chmod spawn-helper for ${dir}: ${e.message}`);
}
}
}
}