node-pty@1.1.0.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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,23 @@ 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. +// 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;
  33. diff --git a/src/unixTerminal.ts b/src/unixTerminal.ts
  34. index 98733dc0cd752b554bd94e45904ca341ad141bba..fa234291206617ae5a6d8605abf9771220392d17 100644
  35. --- a/src/unixTerminal.ts
  36. +++ b/src/unixTerminal.ts
  37. @@ -14,10 +14,21 @@ import { assign, loadNativeModule } from './utils';
  38. const native = loadNativeModule('pty');
  39. const pty: IUnixNative = native.module;
  40. -let helperPath = native.dir + '/spawn-helper';
  41. -helperPath = path.resolve(__dirname, helperPath);
  42. -helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  43. -helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  44. +// A current external embedded-runtime consumer supplies a non-sibling helper.
  45. +let helperPath = process.env.DSH_NODE_PTY_SPAWN_HELPER;
  46. +if (helperPath) {
  47. + helperPath = path.resolve(helperPath);
  48. +} else {
  49. + const executableSibling = process.execPath + '-spawn-helper';
  50. + if (fs.existsSync(executableSibling)) {
  51. + helperPath = executableSibling;
  52. + } else {
  53. + helperPath = native.dir + '/spawn-helper';
  54. + helperPath = path.resolve(__dirname, helperPath);
  55. + helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
  56. + helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
  57. + }
  58. +}
  59. const DEFAULT_FILE = 'sh';
  60. const DEFAULT_NAME = 'xterm';