/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/core/script/fix-node-pty.ts
28 строк
986 B
Shoubhit Dash
refactor(core): consolidate pty service (#30537)
03 июн 2026, 12:47
Не верифицирован
03 июн 2026, 12:47
932fb6c
Код
Авторство
О чём код?
#!/usr/bin/env bun import fs from "fs/promises" import path from "path" import { fileURLToPath } from "url" const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) const dir = path.resolve(__dirname, "..") if (process.platform !== "win32") { const root = path.join(dir, "node_modules", "node-pty", "prebuilds") const dirs = await fs.readdir(root, { withFileTypes: true }).catch(() => []) const files = dirs.filter((x) => x.isDirectory()).map((x) => path.join(root, x.name, "spawn-helper")) const result = await Promise.all( files.map(async (file) => { const stat = await fs.stat(file).catch(() => undefined) if (!stat) return if ((stat.mode & 0o111) === 0o111) return await fs.chmod(file, stat.mode | 0o755) return file }), ) const fixed = result.filter(Boolean) if (fixed.length) { console.log(`fixed node-pty permissions for ${fixed.length} helper${fixed.length === 1 ? "" : "s"}`) } }