From e9490da4e721915df42d1c468ea7c98f879fbb11 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 26 Jul 2018 14:09:54 +0400 Subject: [PATCH] allow using node-pty-prebuilt --- plugins/node_modules/vfs-local/localfs.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/node_modules/vfs-local/localfs.js b/plugins/node_modules/vfs-local/localfs.js index fc1fc779..bd092721 100644 --- a/plugins/node_modules/vfs-local/localfs.js +++ b/plugins/node_modules/vfs-local/localfs.js @@ -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