From e50f0aabd2b8096053c3aecae75f190feebc5aed Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Wed, 19 Feb 2020 07:50:31 -0700 Subject: [PATCH] Include stdout in test worker error messages (#35921) --- src/testRunner/externalCompileRunner.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index cd52bd0ff5f..f1bed960926 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -89,9 +89,9 @@ namespace Harness { Baseline.runBaseline(`${cls.kind()}/${directoryName}.log`, cls.report(cp.spawnSync(`node`, args, { cwd, timeout, shell: true }), cwd)); function exec(command: string, args: string[], options: { cwd: string, timeout?: number }): void { - const res = cp.spawnSync(command, args, { timeout, shell: true, stdio, ...options }); + const res = cp.spawnSync(isWorker ? `${command} 2>&1` : command, args, { shell: true, stdio, ...options }); if (res.status !== 0) { - throw new Error(`${command} ${args.join(" ")} for ${directoryName} failed: ${res.stderr && res.stderr.toString()}`); + throw new Error(`${command} ${args.join(" ")} for ${directoryName} failed: ${res.stdout && res.stdout.toString()}`); } } }); @@ -146,12 +146,12 @@ ${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`; } private timeout = 1_200_000; // 20 minutes; - private exec(command: string, args: string[], options: { cwd: string, timeout?: number }): void { + private exec(command: string, args: string[], options: { cwd: string }): void { const cp: typeof import("child_process") = require("child_process"); const stdio = isWorker ? "pipe" : "inherit"; - const res = cp.spawnSync(command, args, { timeout: this.timeout, shell: true, stdio, ...options }); + const res = cp.spawnSync(isWorker ? `${command} 2>&1` : command, args, { timeout: this.timeout, shell: true, stdio, ...options }); if (res.status !== 0) { - throw new Error(`${command} ${args.join(" ")} for ${options.cwd} failed: ${res.stderr && res.stderr.toString()}`); + throw new Error(`${command} ${args.join(" ")} for ${options.cwd} failed: ${res.stdout && res.stdout.toString()}`); } } report(result: ExecResult) {