use node from c9 dir

pull/85/head^2
nightwing 2015-05-10 03:42:13 +04:00
rodzic 4d9f9be932
commit 9e1bb472c6
4 zmienionych plików z 45 dodań i 30 usunięć

23
node_modules/vfs-child/parent.js wygenerowano vendored
Wyświetl plik

@ -17,17 +17,32 @@ function Parent(fsOptions) {
}
options.stdio = options.customFds = [-1, -1, 2];
var args = [require.resolve('./child.js'), JSON.stringify(fsOptions)];
var executablePath = process.execPath;
var nodeBin = fsOptions.nodeBin || [process.execPath];
var child;
// Override Consumer's connect since the transport logic is internal to this module
this.connect = connect.bind(this);
function connect(callback) {
child = spawn(executablePath, args, options);
child = spawn(nodeBin[0], args, options);
child.stdin.readable = true;
Consumer.prototype.connect.call(this, [child.stdout, child.stdin], callback);
child.stdin.resume();
Consumer.prototype.connect.call(this, [child.stdout, child.stdin], tryNext);
child.on("exit", disconnect);
child.on("error", tryNext);
child.stdin.resume();
var _self = this;
// try all possible locations of node before giving up
function tryNext(err, vfs) {
if (!child) return;
child.removeListener("error", tryNext);
if (err && err.code == "ENOENT" && nodeBin.length > 1) {
child = null;
nodeBin.shift();
_self.emit("error", err);
_self.connect(callback);
} else {
callback(err, vfs);
}
}
}
// Override Consumer's disconnect to kill the child process afterwards

30
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -60,34 +60,28 @@ function logToFile(message){
});
}
console.error(process.env.PATH)
////////////////////////////////////////////////////////////////////////////////
module.exports = function setup(fsOptions) {
var pty;
if (!fsOptions.nopty) {
var e1;
try {
pty = require('pty.js');
} catch(e) {
e1 = e;
[fsOptions.homeDir + "/.c9/node_modules/pty.js", "pty.js", "pty.nw.js"].some(function(p) {
try {
if (os.platform() == "darwin" && os.release() == "11.4.2")
throw new Error("Unsupported Platform " + os.platform() + " " + os.release());
pty = require('pty.nw.js');
} catch(e2) {
console.warn("unable to initialize pty.js:");
console.warn(e1, e2);
pty = function(){};
pty = require(p);
return true;
} catch(e) {
console.warn(e, p);
}
}
});
if (!pty)
console.warn("unable to initialize pty.js:");
}
else {
pty = function(){
if (!pty) {
pty = function(command, options, callback) {
console.log("PTY is not supported.");
};
pty.spawn = pty;
}
var TMUX = fsOptions.tmuxBin || "tmux";

Wyświetl plik

@ -22,6 +22,8 @@ var dbFilePath;
var cachedWS;
var cachedUsers;
var Sequelize;
var debug = false;
function getHomeDir() {
@ -39,18 +41,23 @@ function getProjectWD() {
* npm: sqlite3 & sequelize
*/
function installServer(callback) {
function checkInstalled() {
function checkInstalled(root) {
try {
require("sqlite3");
require("sequelize");
require(root + "sqlite3");
Sequelize = require(root + "sequelize");
return true;
} catch (err) {
console.error(err);
return false;
}
}
if (!checkInstalled()) {
var err = new Error("[vfs-collab] Missing dependencies - NODE_PATH: " + process.env.NODE_PATH + "; node " + process.version);
if (!checkInstalled(getHomeDir() + "/.c9/node_modules/") && !checkInstalled("")) {
var err = new Error("[vfs-collab] Couldn't load node modules sqlite3 and sequelize "
+ "from " + getHomeDir() + "/.c9/node_modules/; "
+ "node version: " + process.version + "; "
+ "node execPath " + process.execPath
);
err.code = "EFATAL";
return callback(err);
}
@ -80,7 +87,6 @@ function wrapSeq(fun, next) {
* @param {Function} callback
*/
function initDB(readonly, callback) {
var Sequelize = require("sequelize");
var MAX_LOG_LINE_LENGTH = 151;
dbFilePath = dbFilePath || Path.join(getProjectWD(), "collab.db");

Wyświetl plik

@ -16,8 +16,8 @@ module.exports = function(manifest, installPath) {
if (win32 && process.env.HOME === undefined) {
process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH;
if (!/msys\/bin|Git\/bin/.test(process.PATH))
process.PATH = path.join(process.env.HOME, ".c9", "msys/bin") + ";" + process.PATH;
if (!/msys\/bin|Git\/bin/.test(process.env.PATH))
process.env.PATH = path.join(process.env.HOME, ".c9", "msys/bin") + ";" + process.env.PATH;
}
var home = process.env.HOME;