kopia lustrzana https://github.com/c9/core
allow quoting $args for runners with script
rodzic
01d8ff6740
commit
43cbd0f187
|
@ -29,7 +29,6 @@ define(function(require, module, exports) {
|
||||||
var STARTING = 1;
|
var STARTING = 1;
|
||||||
var STARTED = 2;
|
var STARTED = 2;
|
||||||
|
|
||||||
var STATIC = options.staticPrefix;
|
|
||||||
var installPath = options.installPath || "~/.c9";
|
var installPath = options.installPath || "~/.c9";
|
||||||
var TMUX = options.tmux || installPath + "/bin/tmux";
|
var TMUX = options.tmux || installPath + "/bin/tmux";
|
||||||
var BASH = "bash";
|
var BASH = "bash";
|
||||||
|
@ -328,7 +327,8 @@ define(function(require, module, exports) {
|
||||||
cmd = insertVariables(cmd, options);
|
cmd = insertVariables(cmd, options);
|
||||||
cmd += typeof runner.script == "string" ? runner.script : runner.script.join("\n");
|
cmd += typeof runner.script == "string" ? runner.script : runner.script.join("\n");
|
||||||
var matches = cmd.match(/\$[\w\-]+/g) || [];
|
var matches = cmd.match(/\$[\w\-]+/g) || [];
|
||||||
var seen = { args: true };
|
var argRe = /\$args(?=\s|$|[&|>;])/g;
|
||||||
|
var seen = { args: argRe.test(cmd) };
|
||||||
cmd = matches.map(function(key) {
|
cmd = matches.map(function(key) {
|
||||||
if (seen[key])
|
if (seen[key])
|
||||||
return "";
|
return "";
|
||||||
|
@ -338,6 +338,8 @@ define(function(require, module, exports) {
|
||||||
return "";
|
return "";
|
||||||
return key.slice(1) + "=" + bashQuote([val]) + ";";
|
return key.slice(1) + "=" + bashQuote([val]) + ";";
|
||||||
}).join("") + "\n" + cmd;
|
}).join("") + "\n" + cmd;
|
||||||
|
// handle args separately to allow passing multiple arguments, or piping the output
|
||||||
|
cmd = cmd.replace(argRe, options.args);
|
||||||
} else {
|
} else {
|
||||||
// @todo add argument escaping
|
// @todo add argument escaping
|
||||||
cmd += bashQuote(options.debug && runner["cmd-debug"] || runner.cmd);
|
cmd += bashQuote(options.debug && runner["cmd-debug"] || runner.cmd);
|
||||||
|
|
Ładowanie…
Reference in New Issue