fix vfs bug when sending streams/processes more than once. add fetching home for tests

pull/85/head
Ruben Daniels 2015-05-01 14:19:15 +00:00
rodzic e150dc8a5a
commit 836fd9222f
3 zmienionych plików z 16 dodań i 2 usunięć

6
node_modules/vfs-socket/worker.js wygenerowano vendored
Wyświetl plik

@ -162,6 +162,9 @@ function Worker(vfs) {
var nextStreamID = 1;
function storeStream(stream) {
if (stream.id)
return { id: stream.id };
nextStreamID = (nextStreamID + 1) % 10000;
while (streams.hasOwnProperty(nextStreamID)) { nextStreamID = (nextStreamID + 1) % 10000; }
var id = nextStreamID;
@ -195,6 +198,9 @@ function Worker(vfs) {
function storeProcess(process, onlyPid) {
var pid = process.pid;
if (processes[pid])
return onlyPid ? process.pid : { pid: process.pid };
processes[pid] = process;
process.on("exit", function (code, signal) {
delete processes[pid];

Wyświetl plik

@ -2,7 +2,7 @@
"use client";
require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (architect, chai, basePath) {
require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "/vfs-home"], function (architect, chai, basePath, homePath) {
var expect = chai.expect;
var Assert = chai.assert;
@ -15,7 +15,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc
hosted: true,
local: false,
davPrefix: "/",
home: "/home/ubuntu"
home: homePath
},
"plugins/c9.core/ext",

Wyświetl plik

@ -156,6 +156,14 @@ function plugin(options, imports, register) {
res.end("define(function(require, exports, module) { return '"
+ options.workspaceDir + "'; });");
});
api.get("/vfs-home", function(req, res, next) {
if (!options.options.testing)
return next();
res.writeHead(200, {"Content-Type": "application/javascript"});
res.end("define(function(require, exports, module) { return '"
+ process.env.HOME + "'; });");
});
api.get("/update", function(req, res, next) {
res.writeHead(200, {