myrlin-workbook 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/postinstall.js +37 -0
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script: fix node-pty spawn-helper permissions on macOS/Linux.
|
|
4
|
+
* The prebuilt spawn-helper binary ships without execute permission (644),
|
|
5
|
+
* causing posix_spawnp failures. This sets it to 755.
|
|
6
|
+
* See: https://github.com/therealarthur/myrlin-workbook/issues/4
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
if (process.platform === 'win32') {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { execSync } = require('child_process');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
|
|
18
|
+
const prebuildsDir = path.join(__dirname, '..', 'node_modules', 'node-pty', 'prebuilds');
|
|
19
|
+
|
|
20
|
+
if (!fs.existsSync(prebuildsDir)) {
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
// Find all spawn-helper binaries across platform dirs and chmod +x them
|
|
26
|
+
const dirs = fs.readdirSync(prebuildsDir, { withFileTypes: true })
|
|
27
|
+
.filter(d => d.isDirectory());
|
|
28
|
+
|
|
29
|
+
for (const dir of dirs) {
|
|
30
|
+
const helper = path.join(prebuildsDir, dir.name, 'spawn-helper');
|
|
31
|
+
if (fs.existsSync(helper)) {
|
|
32
|
+
execSync(`chmod +x "${helper}"`, { stdio: 'ignore' });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} catch (_) {
|
|
36
|
+
// Non-fatal: if chmod fails, user can still manually fix
|
|
37
|
+
}
|