From 54fca08a9177300b3a396ac86c42070aef3a06e4 Mon Sep 17 00:00:00 2001 From: Raghu Simha Date: Tue, 30 Jan 2018 15:59:43 -0500 Subject: [PATCH 1/2] Make exec.spawnProcess work across platforms --- build-system/exec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-system/exec.js b/build-system/exec.js index 1f97ed1b7f55..ad197425a1a5 100644 --- a/build-system/exec.js +++ b/build-system/exec.js @@ -29,7 +29,7 @@ const childProcess = require('child_process'); * @return {} Process info. */ function spawnProcess(cmd, options) { - return childProcess.spawnSync('/bin/sh', ['-c', cmd], options); + return childProcess.spawnSync(cmd, options); } /** @@ -67,6 +67,7 @@ function getOutput(cmd) { 'env': process.env, 'stdio': 'pipe', 'encoding': 'utf-8', + 'shell': true, }); return p; } From 02745a1b34e202130ee4ada2601d6c715ce1bd45 Mon Sep 17 00:00:00 2001 From: Raghu Simha Date: Tue, 30 Jan 2018 19:32:57 -0500 Subject: [PATCH 2/2] Restore shell command, since 'shell: true' didn't work --- build-system/exec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-system/exec.js b/build-system/exec.js index ad197425a1a5..e0aa51d21e20 100644 --- a/build-system/exec.js +++ b/build-system/exec.js @@ -21,6 +21,9 @@ const childProcess = require('child_process'); +const shellCmd = (process.platform == 'win32') ? 'cmd' : '/bin/sh'; +const shellFlag = (process.platform == 'win32') ? '/C' : '-c'; + /** * Spawns the given command in a child process with the given options. * @@ -29,7 +32,7 @@ const childProcess = require('child_process'); * @return {} Process info. */ function spawnProcess(cmd, options) { - return childProcess.spawnSync(cmd, options); + return childProcess.spawnSync(shellCmd, [shellFlag, cmd], options); } /** @@ -67,7 +70,6 @@ function getOutput(cmd) { 'env': process.env, 'stdio': 'pipe', 'encoding': 'utf-8', - 'shell': true, }); return p; }