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