kopia lustrzana https://github.com/c9/core
fix vfs bug when sending streams/processes more than once. add fetching home for tests
rodzic
e150dc8a5a
commit
836fd9222f
|
@ -162,6 +162,9 @@ function Worker(vfs) {
|
||||||
|
|
||||||
var nextStreamID = 1;
|
var nextStreamID = 1;
|
||||||
function storeStream(stream) {
|
function storeStream(stream) {
|
||||||
|
if (stream.id)
|
||||||
|
return { id: stream.id };
|
||||||
|
|
||||||
nextStreamID = (nextStreamID + 1) % 10000;
|
nextStreamID = (nextStreamID + 1) % 10000;
|
||||||
while (streams.hasOwnProperty(nextStreamID)) { nextStreamID = (nextStreamID + 1) % 10000; }
|
while (streams.hasOwnProperty(nextStreamID)) { nextStreamID = (nextStreamID + 1) % 10000; }
|
||||||
var id = nextStreamID;
|
var id = nextStreamID;
|
||||||
|
@ -195,6 +198,9 @@ function Worker(vfs) {
|
||||||
|
|
||||||
function storeProcess(process, onlyPid) {
|
function storeProcess(process, onlyPid) {
|
||||||
var pid = process.pid;
|
var pid = process.pid;
|
||||||
|
if (processes[pid])
|
||||||
|
return onlyPid ? process.pid : { pid: process.pid };
|
||||||
|
|
||||||
processes[pid] = process;
|
processes[pid] = process;
|
||||||
process.on("exit", function (code, signal) {
|
process.on("exit", function (code, signal) {
|
||||||
delete processes[pid];
|
delete processes[pid];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
"use client";
|
"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 expect = chai.expect;
|
||||||
var Assert = chai.assert;
|
var Assert = chai.assert;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc
|
||||||
hosted: true,
|
hosted: true,
|
||||||
local: false,
|
local: false,
|
||||||
davPrefix: "/",
|
davPrefix: "/",
|
||||||
home: "/home/ubuntu"
|
home: homePath
|
||||||
},
|
},
|
||||||
|
|
||||||
"plugins/c9.core/ext",
|
"plugins/c9.core/ext",
|
||||||
|
|
|
@ -156,6 +156,14 @@ function plugin(options, imports, register) {
|
||||||
res.end("define(function(require, exports, module) { return '"
|
res.end("define(function(require, exports, module) { return '"
|
||||||
+ options.workspaceDir + "'; });");
|
+ 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) {
|
api.get("/update", function(req, res, next) {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
|
|
Ładowanie…
Reference in New Issue