node-pty@1.1.0.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. diff --git a/lib/unixTerminal.js b/lib/unixTerminal.js
  2. index 1ec12f796a822c78fba9ad7f6448c3987e325c23..5cd6b7d635f4752be5a6c5ff9cf9edf988cf94c5 100644
  3. --- a/lib/unixTerminal.js
  4. +++ b/lib/unixTerminal.js
  5. @@ -26,10 +26,22 @@ var terminal_1 = require("./terminal");
  6. var utils_1 = require("./utils");
  7. var native = 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. +var helperPath = process.env.DSH_NODE_PTY_SPAWN_HELPER;
  14. +if (helperPath) {
  15. + helperPath = path.resolve(helperPath);
  16. +}
  17. +else {
  18. + var executableSibling = process.execPath + '-spawn-helper';
  19. + if (fs.existsSync(executableSibling)) {
  20. + helperPath = executableSibling;
  21. + }
  22. + else {
  23. + helperPath = native.dir + '/spawn-helper';
  24. + helperPath = path.resolve(__dirname, helperPath);
  25. + helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  26. + helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  27. + }
  28. +}
  29. var DEFAULT_FILE = 'sh';
  30. var DEFAULT_NAME = 'xterm';
  31. var DESTROY_SOCKET_TIMEOUT_MS = 200;
  32. diff --git a/src/unixTerminal.ts b/src/unixTerminal.ts
  33. index 98733dc0cd752b554bd94e45904ca341ad141bba..fa234291206617ae5a6d8605abf9771220392d17 100644
  34. --- a/src/unixTerminal.ts
  35. +++ b/src/unixTerminal.ts
  36. @@ -14,10 +14,20 @@ import { assign, loadNativeModule } from './utils';
  37. const native = loadNativeModule('pty');
  38. const pty: IUnixNative = native.module;
  39. -let helperPath = native.dir + '/spawn-helper';
  40. -helperPath = path.resolve(__dirname, helperPath);
  41. -helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  42. -helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  43. +let helperPath = process.env.DSH_NODE_PTY_SPAWN_HELPER;
  44. +if (helperPath) {
  45. + helperPath = path.resolve(helperPath);
  46. +} else {
  47. + const executableSibling = process.execPath + '-spawn-helper';
  48. + if (fs.existsSync(executableSibling)) {
  49. + helperPath = executableSibling;
  50. + } else {
  51. + helperPath = native.dir + '/spawn-helper';
  52. + helperPath = path.resolve(__dirname, helperPath);
  53. + helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  54. + helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  55. + }
  56. +}
  57. const DEFAULT_FILE = 'sh';
  58. const DEFAULT_NAME = 'xterm';