From 2ac410625b6a5385701092aaa83bb0b10b79e98a Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Wed, 3 May 2017 08:17:31 -0500 Subject: [PATCH] Fixes shell parameters quoting after #8349 --- gulpfile.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 81b5680ea..703981b9c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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) {