allow using node-pty-prebuilt

pull/518/head
nightwing 2018-07-26 14:09:54 +04:00
rodzic 79a69bd9f7
commit e9490da4e7
1 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -85,15 +85,17 @@ module.exports = function setup(fsOptions) {
require("module")._initPaths();
}
if (!fsOptions.nopty) {
var modulesPath = fsOptions.nodePath || process.env.HOME + "/.c9/node_modules";
// on darwin trying to load binary for a wrong version crashes the process
[(fsOptions.nodePath || process.env.HOME + "/.c9/node_modules") + "/pty.js",
"pty.js"].some(function(p) {
[modulesPath + "/node-pty-prebuilt",
modulesPath + "/pty.js",
"node-pty-prebuilt",
"pty.js"
].some(function(p) {
try {
pty = require(p);
return true;
} catch(e) {
console.warn(e, p);
}
} catch(e) {}
});
if (!pty)
console.warn("unable to initialize pty.js:");
@ -1685,6 +1687,9 @@ module.exports = function setup(fsOptions) {
var proc;
try {
proc = pty.spawn(path, args, options);
proc.readable = true;
proc.writable = true;
proc.on("error", function(){
// Prevent PTY from throwing an error;
// I don't know how to test and the src is funky because