@nubase/terminal 0.1.0 → 0.1.1
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/out/main/index.js +23 -1
- package/package.json +1 -1
package/out/main/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from "node:url";
|
|
|
4
4
|
import { BaseWindow, BrowserWindow, Menu, WebContentsView, app, dialog, ipcMain, nativeImage, net, protocol, safeStorage, shell } from "electron";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
|
-
import { createReadStream, existsSync, mkdirSync, statSync, watch } from "node:fs";
|
|
7
|
+
import { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, statSync, watch } from "node:fs";
|
|
8
8
|
import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
9
9
|
import { execFile } from "node:child_process";
|
|
10
10
|
import { promisify } from "node:util";
|
|
@@ -1157,12 +1157,34 @@ var BUILTIN_EXTENSIONS = [
|
|
|
1157
1157
|
];
|
|
1158
1158
|
//#endregion
|
|
1159
1159
|
//#region src/main/services/pty/PtyHost.ts
|
|
1160
|
+
var spawnHelperChecked = false;
|
|
1161
|
+
/**
|
|
1162
|
+
* npm installs node-pty's prebuilt macOS/Linux `spawn-helper` without its
|
|
1163
|
+
* execute bit, which makes every spawn fail with "posix_spawnp failed".
|
|
1164
|
+
*/
|
|
1165
|
+
var ensureSpawnHelperExecutable = () => {
|
|
1166
|
+
if (spawnHelperChecked || process.platform === "win32") return;
|
|
1167
|
+
spawnHelperChecked = true;
|
|
1168
|
+
try {
|
|
1169
|
+
const root = dirname(createRequire(import.meta.url).resolve("node-pty/package.json"));
|
|
1170
|
+
const candidates = [join(root, "build", "Release", "spawn-helper"), join(root, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper")];
|
|
1171
|
+
for (const file of candidates) {
|
|
1172
|
+
if (!existsSync(file)) continue;
|
|
1173
|
+
try {
|
|
1174
|
+
accessSync(file, constants.X_OK);
|
|
1175
|
+
} catch {
|
|
1176
|
+
chmodSync(file, 493);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
} catch {}
|
|
1180
|
+
};
|
|
1160
1181
|
var PtyHost = class {
|
|
1161
1182
|
ptys = /* @__PURE__ */ new Map();
|
|
1162
1183
|
constructor(options) {
|
|
1163
1184
|
this.options = options;
|
|
1164
1185
|
}
|
|
1165
1186
|
async spawn(options) {
|
|
1187
|
+
ensureSpawnHelperExecutable();
|
|
1166
1188
|
const pty = await import("node-pty");
|
|
1167
1189
|
const shell = process.env.SHELL ?? (process.platform === "win32" ? "powershell.exe" : "/bin/zsh");
|
|
1168
1190
|
const id = randomUUID();
|