From ddb5ab936e19dac1878ddecc0c34e7c14cd49b6f Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Fri, 6 Aug 2021 15:15:29 +0200 Subject: [PATCH] fix(cli): avoid cmd.exe windows popping up during execution --- core/src/plugins/exec.ts | 1 + core/src/util/ext-tools.ts | 2 +- core/src/util/util.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/plugins/exec.ts b/core/src/plugins/exec.ts index 88257c7046..3899768b94 100644 --- a/core/src/plugins/exec.ts +++ b/core/src/plugins/exec.ts @@ -292,6 +292,7 @@ export async function buildExecModule({ module, log }: BuildModuleParams' instead. shell: true, }) diff --git a/core/src/util/ext-tools.ts b/core/src/util/ext-tools.ts index 40c963934f..205e952190 100644 --- a/core/src/util/ext-tools.ts +++ b/core/src/util/ext-tools.ts @@ -112,7 +112,7 @@ export class CliWrapper { } log.debug(`Spawning '${path} ${args.join(" ")}' in ${cwd}`) - return crossSpawn(path, args, { cwd, env }) + return crossSpawn(path, args, { cwd, env, windowsHide: true }) } async spawnAndWait({ args, cwd, env, log, ignoreError, rawMode, stdout, stderr, timeoutSec, tty }: SpawnParams) { diff --git a/core/src/util/util.ts b/core/src/util/util.ts index 08d82a858a..e13024f5b7 100644 --- a/core/src/util/util.ts +++ b/core/src/util/util.ts @@ -169,7 +169,7 @@ interface ExecOpts extends execa.Options { */ export async function exec(cmd: string, args: string[], opts: ExecOpts = {}) { // Ensure buffer is always set to true so that we can read the error output - opts = { ...opts, buffer: true, all: true } + opts = { windowsHide: true, ...opts, buffer: true, all: true } const proc = execa(cmd, args, omit(opts, ["stdout", "stderr"])) opts.stdout && proc.stdout && proc.stdout.pipe(opts.stdout) @@ -242,7 +242,7 @@ export function spawn(cmd: string, args: string[], opts: SpawnOpts = {}) { } = opts const stdio = tty ? "inherit" : "pipe" - const proc = _spawn(cmd, args, { cwd, env, stdio }) + const proc = _spawn(cmd, args, { cwd, env, stdio, windowsHide: true }) const result: SpawnOutput = { code: 0,