fix quoting of args in runner.script

pull/483/head
Harutyun Amirjanyan 2018-02-04 10:24:02 +00:00
rodzic 58b6fa3d98
commit 6d29c6b3dc
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -350,6 +350,8 @@ define(function(require, exports, module) {
continue;
}
if (c === " ") {
if (!results.raw)
results.raw = pathArgs.substr(i);
if (lastStart < i)
results.push(pathArgs.substring(lastStart, i));
lastStart = i + 1;

Wyświetl plik

@ -328,7 +328,7 @@ define(function(require, module, exports) {
cmd += typeof runner.script == "string" ? runner.script : runner.script.join("\n");
var matches = cmd.match(/\$[\w\-]+/g) || [];
var argRe = /\$args(?=\s|$|[&|>;])/g;
var seen = { args: argRe.test(cmd) };
var seen = { $args: true };
cmd = matches.map(function(key) {
if (seen[key])
return "";
@ -339,7 +339,7 @@ define(function(require, module, exports) {
return key.slice(1) + "=" + bashQuote([val]) + ";";
}).join("") + "\n" + cmd;
// handle args separately to allow passing multiple arguments, or piping the output
cmd = cmd.replace(argRe, options.args);
cmd = cmd.replace(argRe, options.args && options.args.raw || getVariable("args", options));
} else {
// @todo add argument escaping
cmd += bashQuote(options.debug && runner["cmd-debug"] || runner.cmd);