Fixes shell parameters quoting after #8349
This commit is contained in:
parent
b4787f0d38
commit
2ac410625b
@ -88,6 +88,13 @@ function safeSpawnSync(command, parameters, options) {
|
|||||||
// Execute all commands in a shell.
|
// Execute all commands in a shell.
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.shell = true;
|
options.shell = true;
|
||||||
|
// `options.shell = true` requires parameters to be quoted.
|
||||||
|
parameters = parameters.map((param) => {
|
||||||
|
if (!/[\s`~!#$*(){\[|\\;'"<>?]/.test(param)) {
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
return '\"' + param.replace(/([$\\"`])/g, '\\$1') + '\"';
|
||||||
|
});
|
||||||
|
|
||||||
var result = spawnSync(command, parameters, options);
|
var result = spawnSync(command, parameters, options);
|
||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user