chore(subprocess-local): bump node-pty beta

This commit is contained in:
_Kerman
2026-08-13 17:57:58 +08:00
parent 5a16a5eaf5
commit 078dd2b6df
5 changed files with 40 additions and 70 deletions

View File

@@ -0,0 +1,32 @@
diff --git a/lib/unixTerminal.js b/lib/unixTerminal.js
index 6966d24..18f1d25 100644
--- a/lib/unixTerminal.js
+++ b/lib/unixTerminal.js
@@ -28,10 +28,23 @@ var terminal_1 = require("./terminal");
var utils_1 = require("./utils");
var native = (0, utils_1.loadNativeModule)('pty');
var pty = native.module;
-var helperPath = native.dir + '/spawn-helper';
-helperPath = path.resolve(__dirname, helperPath);
-helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
-helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
+// A current external embedded-runtime consumer supplies a non-sibling helper.
+var helperPath = process.env.DSH_NODE_PTY_SPAWN_HELPER;
+if (helperPath) {
+ helperPath = path.resolve(helperPath);
+}
+else {
+ var executableSibling = process.execPath + '-spawn-helper';
+ if (fs.existsSync(executableSibling)) {
+ helperPath = executableSibling;
+ }
+ else {
+ helperPath = native.dir + '/spawn-helper';
+ helperPath = path.resolve(__dirname, helperPath);
+ helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
+ helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
+ }
+}
var DEFAULT_FILE = 'sh';
var DEFAULT_NAME = 'xterm';
var DESTROY_SOCKET_TIMEOUT_MS = 200;