node-pty@1.2.0-beta.15.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. diff --git a/lib/unixTerminal.js b/lib/unixTerminal.js
  2. index 6966d24..18f1d25 100644
  3. --- a/lib/unixTerminal.js
  4. +++ b/lib/unixTerminal.js
  5. @@ -28,10 +28,23 @@ var terminal_1 = require("./terminal");
  6. var utils_1 = require("./utils");
  7. var native = (0, utils_1.loadNativeModule)('pty');
  8. var pty = native.module;
  9. -var helperPath = native.dir + '/spawn-helper';
  10. -helperPath = path.resolve(__dirname, helperPath);
  11. -helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  12. -helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  13. +// A current external embedded-runtime consumer supplies a non-sibling helper.
  14. +var helperPath = process.env.DSH_NODE_PTY_SPAWN_HELPER;
  15. +if (helperPath) {
  16. + helperPath = path.resolve(helperPath);
  17. +}
  18. +else {
  19. + var executableSibling = process.execPath + '-spawn-helper';
  20. + if (fs.existsSync(executableSibling)) {
  21. + helperPath = executableSibling;
  22. + }
  23. + else {
  24. + helperPath = native.dir + '/spawn-helper';
  25. + helperPath = path.resolve(__dirname, helperPath);
  26. + helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  27. + helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  28. + }
  29. +}
  30. var DEFAULT_FILE = 'sh';
  31. var DEFAULT_NAME = 'xterm';
  32. var DESTROY_SOCKET_TIMEOUT_MS = 200;