Fixes shell parameters quoting after #8349

This commit is contained in:
Yury Delendik 2017-05-03 08:17:31 -05:00
parent b4787f0d38
commit 2ac410625b

View File

@ -88,6 +88,13 @@ function safeSpawnSync(command, parameters, options) {
// Execute all commands in a shell.
options = options || {};
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);
if (result.status !== 0) {