From 3772c82bebd4b85affcbea31a6933ff97b6ff21b Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 17 Mar 2020 20:40:48 +0100 Subject: [PATCH] cli: use shell option to fix build issues on windows --- packages/cli/src/commands/plugin/build.ts | 2 +- packages/cli/src/commands/plugin/lint.ts | 2 +- packages/cli/src/commands/plugin/testCommand.ts | 2 +- packages/cli/src/commands/watch-deps/child.ts | 1 + packages/cli/src/commands/watch-deps/compiler.ts | 1 + scripts/cli-e2e-test.js | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/plugin/build.ts b/packages/cli/src/commands/plugin/build.ts index 6607b0507a..939f2bfd31 100644 --- a/packages/cli/src/commands/plugin/build.ts +++ b/packages/cli/src/commands/plugin/build.ts @@ -37,7 +37,7 @@ export default async (cmd: Command) => { try { await copyStaticAssets(); - const result = spawnSync('tsc', args, { stdio: 'inherit' }); + const result = spawnSync('tsc', args, { stdio: 'inherit', shell: true }); if (result.error) { throw result.error; } diff --git a/packages/cli/src/commands/plugin/lint.ts b/packages/cli/src/commands/plugin/lint.ts index 2a06b761bc..fb7af7aec0 100644 --- a/packages/cli/src/commands/plugin/lint.ts +++ b/packages/cli/src/commands/plugin/lint.ts @@ -25,7 +25,7 @@ export default async (cmd: Command) => { } try { - const result = spawnSync('web-scripts', args, { stdio: 'inherit' }); + const result = spawnSync('web-scripts', args, { stdio: 'inherit', shell: true }); if (result.error) { throw result.error; } diff --git a/packages/cli/src/commands/plugin/testCommand.ts b/packages/cli/src/commands/plugin/testCommand.ts index 9a83fca09e..9e51cf4388 100644 --- a/packages/cli/src/commands/plugin/testCommand.ts +++ b/packages/cli/src/commands/plugin/testCommand.ts @@ -29,7 +29,7 @@ export default async (cmd: Command) => { } try { - const result = spawnSync('web-scripts', args, { stdio: 'inherit' }); + const result = spawnSync('web-scripts', args, { stdio: 'inherit', shell: true }); if (result.error) { throw result.error; } diff --git a/packages/cli/src/commands/watch-deps/child.ts b/packages/cli/src/commands/watch-deps/child.ts index acace2656a..a5fcae0401 100644 --- a/packages/cli/src/commands/watch-deps/child.ts +++ b/packages/cli/src/commands/watch-deps/child.ts @@ -23,6 +23,7 @@ export function startChild(args: string[]) { const child = spawn(command, commandArgs, { env: { FORCE_COLOR: 'true', ...process.env }, stdio: ['inherit', 'pipe', 'pipe'], + shell: true, }); // We need to avoid clearing the terminal, or the build feedback of dependencies will be lost diff --git a/packages/cli/src/commands/watch-deps/compiler.ts b/packages/cli/src/commands/watch-deps/compiler.ts index fbe6fcd18b..ee3ef28ae1 100644 --- a/packages/cli/src/commands/watch-deps/compiler.ts +++ b/packages/cli/src/commands/watch-deps/compiler.ts @@ -31,6 +31,7 @@ export function startCompiler(pkg: Package, log: Logger) { cwd: pkg.location, env: { FORCE_COLOR: 'true', ...process.env }, stdio: 'pipe', + shell: true, }); watch.stdin.end(); diff --git a/scripts/cli-e2e-test.js b/scripts/cli-e2e-test.js index 7735b04779..4ab41a7a58 100644 --- a/scripts/cli-e2e-test.js +++ b/scripts/cli-e2e-test.js @@ -68,7 +68,7 @@ function spawnPiped(cmd, options) { }; } - const child = spawn(cmd[0], cmd.slice(1), { stdio: 'pipe', ...options }); + const child = spawn(cmd[0], cmd.slice(1), { stdio: 'pipe', shell: true, ...options }); child.on('error', handleError); child.on('exit', code => { if (code) {