kopia lustrzana https://github.com/c9/core
remove unused and undocumented support for array of runners in run.run
rodzic
247a2ae9e3
commit
e5586d5069
|
@ -542,8 +542,8 @@ define(function(require, exports, module) {
|
||||||
function getProxySource(process) {
|
function getProxySource(process) {
|
||||||
return PROXY.replace(/\/\/.*/g, "")
|
return PROXY.replace(/\/\/.*/g, "")
|
||||||
.replace(/[\n\r]/g, "")
|
.replace(/[\n\r]/g, "")
|
||||||
.replace(/\{DEBUGGED_PROCESS_PORT\}/, (process.runner[0] || process.runner).debugport)
|
.replace(/\{DEBUGGED_PROCESS_PORT\}/, process.runner.debugport)
|
||||||
.replace(/\{DEBUGGED_PROCESS_HOST\}/, (process.runner[0] || process.runner).debughost || "127.0.0.1");
|
.replace(/\{DEBUGGED_PROCESS_HOST\}/, process.runner.debughost || "127.0.0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -455,8 +455,8 @@ define(function(require, exports, module) {
|
||||||
return PROXY
|
return PROXY
|
||||||
.replace(/\/\/.*/g, "")
|
.replace(/\/\/.*/g, "")
|
||||||
.replace(/[\n\r]/g, "")
|
.replace(/[\n\r]/g, "")
|
||||||
.replace(/\{HOST\}/, process.runner[0].debughost || "")
|
.replace(/\{HOST\}/, process.runner.debughost || "")
|
||||||
.replace(/\{PORT\}/, process.runner[0].debugport);
|
.replace(/\{PORT\}/, process.runner.debugport);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBreakpoints(breakpoints, callback) {
|
function setBreakpoints(breakpoints, callback) {
|
||||||
|
|
|
@ -232,9 +232,9 @@ define(function(require, exports, module) {
|
||||||
var socketpath = Path.join(c9.home, "/.c9/gdbdebugger.socket");
|
var socketpath = Path.join(c9.home, "/.c9/gdbdebugger.socket");
|
||||||
return {
|
return {
|
||||||
source: null,
|
source: null,
|
||||||
socketpath: process.runner[0].socketpath || socketpath,
|
socketpath: process.runner.socketpath || socketpath,
|
||||||
retryInverval: process.runner[0].retryInterval || 300,
|
retryInverval: process.runner.retryInterval || 300,
|
||||||
retries: process.runner[0].retryCount || 1000
|
retries: process.runner.retryCount || 1000
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -605,7 +605,7 @@ define(function(require, exports, module) {
|
||||||
return debug.proxySource
|
return debug.proxySource
|
||||||
.replace(/\/\/.*/g, "")
|
.replace(/\/\/.*/g, "")
|
||||||
.replace(/[\n\r]/g, "")
|
.replace(/[\n\r]/g, "")
|
||||||
.replace(/\{PORT\}/, (process.runner[0] || process.runner).debugport);
|
.replace(/\{PORT\}/, process.runner.debugport);
|
||||||
}
|
}
|
||||||
|
|
||||||
function attach(s, reconnect, callback) {
|
function attach(s, reconnect, callback) {
|
||||||
|
|
|
@ -134,7 +134,7 @@ define(function(require, module, exports) {
|
||||||
return re.test(file);
|
return re.test(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (selector instanceof Array) {
|
else if (Array.isArray(selector)) {
|
||||||
return selector.some(function(n) {
|
return selector.some(function(n) {
|
||||||
return matchSelector(n, path);
|
return matchSelector(n, path);
|
||||||
});
|
});
|
||||||
|
@ -213,12 +213,11 @@ define(function(require, module, exports) {
|
||||||
if (!name)
|
if (!name)
|
||||||
name = "output";
|
name = "output";
|
||||||
|
|
||||||
(options instanceof Array ? options : [options]).forEach(function(a) {
|
|
||||||
a.relPath = a.path;
|
options.relPath = options.path;
|
||||||
a.path = makeAbsolutePath(a.path);
|
options.path = makeAbsolutePath(options.path);
|
||||||
a.path = c9.toExternalPath(a.path, "/");
|
options.path = c9.toExternalPath(options.path, "/");
|
||||||
a.cwd = makeAbsolutePath(a.cwd);
|
options.cwd = makeAbsolutePath(options.cwd);
|
||||||
});
|
|
||||||
|
|
||||||
var proc = new Process(name, runner, options, callback);
|
var proc = new Process(name, runner, options, callback);
|
||||||
processes.push(proc);
|
processes.push(proc);
|
||||||
|
@ -297,67 +296,55 @@ define(function(require, module, exports) {
|
||||||
|
|
||||||
emit("starting");
|
emit("starting");
|
||||||
|
|
||||||
if (!(runner instanceof Array))
|
|
||||||
runner = [runner];
|
|
||||||
|
|
||||||
if (!(options instanceof Array))
|
|
||||||
options = [options];
|
|
||||||
|
|
||||||
if (deferred)
|
if (deferred)
|
||||||
return setTimeout(callback);
|
return setTimeout(callback);
|
||||||
|
|
||||||
cmd = runner.map(function(runner, idx) {
|
var cmd = "";
|
||||||
var cmd = "";
|
|
||||||
|
|
||||||
// Display a message prior to running the command
|
|
||||||
if (runner.info)
|
|
||||||
cmd += "printf '\\033[1m" + runner.info.replace(/%/g, "%%") + "\\033[m\n' ; ";
|
|
||||||
|
|
||||||
// Set the PATH variable if needed
|
|
||||||
if (runner.path)
|
|
||||||
cmd += "export PATH=" + runner.path + " ; ";
|
|
||||||
|
|
||||||
var env = util.extend({}, options[idx].env, runner.env);
|
|
||||||
for (var name in env) {
|
|
||||||
// HACK: old configurations used double quoting of environment values;
|
|
||||||
// let's support such nastiness for now
|
|
||||||
var value = /^["'].*["']$/.test(env[name])
|
|
||||||
? env[name]
|
|
||||||
: env[name].replace(/'/g, "'\\''");
|
|
||||||
cmd += "export " + name + "='" + value + "'; ";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open a pty session with tmux on the output buffer
|
|
||||||
if (runner.script) {
|
|
||||||
// Replace variables
|
|
||||||
cmd = insertVariables(cmd, options[idx]);
|
|
||||||
cmd += typeof runner.script == "string" ? runner.script : runner.script.join("\n");
|
|
||||||
var matches = cmd.match(/\$[\w\-]+/g) || [];
|
|
||||||
var seen = {};
|
|
||||||
cmd = matches.map(function(key) {
|
|
||||||
if (seen[key])
|
|
||||||
return "";
|
|
||||||
seen[key] = 1;
|
|
||||||
var val = getVariable(key.slice(1), options[idx]);
|
|
||||||
if (val == key)
|
|
||||||
return "";
|
|
||||||
return key.slice(1) + "=" + bashQuote([val]) + ";";
|
|
||||||
}).join("") + "\n" + cmd;
|
|
||||||
} else {
|
|
||||||
// @todo add argument escaping
|
|
||||||
cmd += bashQuote(options[idx].debug && runner["cmd-debug"] || runner.cmd);
|
|
||||||
// Replace variables
|
|
||||||
cmd = insertVariables(cmd, options[idx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmd;
|
|
||||||
}).join("; ");
|
|
||||||
|
|
||||||
// The rest of the options are singular. Choosing the first option object for this.
|
// Display a message prior to running the command
|
||||||
options = options[0];
|
if (runner.info)
|
||||||
|
cmd += "printf '\\033[1m" + runner.info.replace(/%/g, "%%") + "\\033[m\n' ; ";
|
||||||
|
|
||||||
|
// Set the PATH variable if needed
|
||||||
|
if (runner.path)
|
||||||
|
cmd += "export PATH=" + runner.path + " ; ";
|
||||||
|
|
||||||
|
var env = util.extend({}, options.env, runner.env);
|
||||||
|
for (var name in env) {
|
||||||
|
// HACK: old configurations used double quoting of environment values;
|
||||||
|
// let's support such nastiness for now
|
||||||
|
var value = /^["'].*["']$/.test(env[name])
|
||||||
|
? env[name]
|
||||||
|
: env[name].replace(/'/g, "'\\''");
|
||||||
|
cmd += "export " + name + "='" + value + "'; ";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open a pty session with tmux on the output buffer
|
||||||
|
if (runner.script) {
|
||||||
|
// Replace variables
|
||||||
|
cmd = insertVariables(cmd, options);
|
||||||
|
cmd += typeof runner.script == "string" ? runner.script : runner.script.join("\n");
|
||||||
|
var matches = cmd.match(/\$[\w\-]+/g) || [];
|
||||||
|
var seen = { args: true };
|
||||||
|
cmd = matches.map(function(key) {
|
||||||
|
if (seen[key])
|
||||||
|
return "";
|
||||||
|
seen[key] = 1;
|
||||||
|
var val = getVariable(key.slice(1), options);
|
||||||
|
if (val == key)
|
||||||
|
return "";
|
||||||
|
return key.slice(1) + "=" + bashQuote([val]) + ";";
|
||||||
|
}).join("") + "\n" + cmd;
|
||||||
|
} else {
|
||||||
|
// @todo add argument escaping
|
||||||
|
cmd += bashQuote(options.debug && runner["cmd-debug"] || runner.cmd);
|
||||||
|
// Replace variables
|
||||||
|
cmd = insertVariables(cmd, options);
|
||||||
|
}
|
||||||
|
|
||||||
var cwd = options.cwd || runner[0].working_dir
|
var cwd = options.cwd || runner.working_dir
|
||||||
|| options.path && dirname(c9.toInternalPath(options.path)) || "/";
|
|| options.path && dirname(c9.toInternalPath(options.path)) || "/";
|
||||||
|
|
||||||
cwd = insertVariables(cwd, options);
|
cwd = insertVariables(cwd, options);
|
||||||
console.log(cmd);
|
console.log(cmd);
|
||||||
// Execute run.sh
|
// Execute run.sh
|
||||||
|
@ -595,7 +582,7 @@ define(function(require, module, exports) {
|
||||||
if (c9.platform === "win32")
|
if (c9.platform === "win32")
|
||||||
return proc.execFile("kill", { args: [pid]}, done);
|
return proc.execFile("kill", { args: [pid]}, done);
|
||||||
|
|
||||||
var runCfg = runner && runner[0];
|
var runCfg = runner;
|
||||||
|
|
||||||
if (runCfg && runCfg.cmdStop) {
|
if (runCfg && runCfg.cmdStop) {
|
||||||
return proc.execFile("bash", { args: ["-c", bashQuote(runCfg.cmdStop)]}, done);
|
return proc.execFile("bash", { args: ["-c", bashQuote(runCfg.cmdStop)]}, done);
|
||||||
|
@ -605,9 +592,9 @@ define(function(require, module, exports) {
|
||||||
if (runCfg && runCfg.cmdCleanup) {
|
if (runCfg && runCfg.cmdCleanup) {
|
||||||
proc.execFile("bash", { args: ["-c", bashQuote(runCfg.cmdCleanup)]}, done);
|
proc.execFile("bash", { args: ["-c", bashQuote(runCfg.cmdCleanup)]}, done);
|
||||||
}
|
}
|
||||||
else if (meta.debug && runner && runner[0].debugport) {
|
else if (meta.debug && runner && runner.debugport) {
|
||||||
var kill = "kill -9 $(lsof -i:" + runner[0].debugport + " -t);"
|
var kill = "kill -9 $(lsof -i:" + runner.debugport + " -t);"
|
||||||
+ "if sudo -n true; then sudo kill -9 $(sudo lsof -i:" + runner[0].debugport + " -t); fi";
|
+ "if sudo -n true; then sudo kill -9 $(sudo lsof -i:" + runner.debugport + " -t); fi";
|
||||||
proc.execFile("sh", { args: ["-c", kill]}, done);
|
proc.execFile("sh", { args: ["-c", kill]}, done);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -24,7 +24,7 @@ define(function(require, exports, module) {
|
||||||
if (!e.process.runner)
|
if (!e.process.runner)
|
||||||
return;
|
return;
|
||||||
// Gets called whenever one creates a new process
|
// Gets called whenever one creates a new process
|
||||||
var runner = e.process.runner[0];
|
var runner = e.process.runner;
|
||||||
var builtin = runner.$builtin;
|
var builtin = runner.$builtin;
|
||||||
var runnerName = runner.caption;
|
var runnerName = runner.caption;
|
||||||
var cmdLength = runner.cmd && runner.cmd.length;
|
var cmdLength = runner.cmd && runner.cmd.length;
|
||||||
|
|
Ładowanie…
Reference in New Issue