Skip to content

Commit e50f0aa

Browse files
authored
Include stdout in test worker error messages (#35921)
1 parent bab0c99 commit e50f0aa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/testRunner/externalCompileRunner.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ namespace Harness {
8989
Baseline.runBaseline(`${cls.kind()}/${directoryName}.log`, cls.report(cp.spawnSync(`node`, args, { cwd, timeout, shell: true }), cwd));
9090

9191
function exec(command: string, args: string[], options: { cwd: string, timeout?: number }): void {
92-
const res = cp.spawnSync(command, args, { timeout, shell: true, stdio, ...options });
92+
const res = cp.spawnSync(isWorker ? `${command} 2>&1` : command, args, { shell: true, stdio, ...options });
9393
if (res.status !== 0) {
94-
throw new Error(`${command} ${args.join(" ")} for ${directoryName} failed: ${res.stderr && res.stderr.toString()}`);
94+
throw new Error(`${command} ${args.join(" ")} for ${directoryName} failed: ${res.stdout && res.stdout.toString()}`);
9595
}
9696
}
9797
});
@@ -146,12 +146,12 @@ ${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`;
146146
}
147147

148148
private timeout = 1_200_000; // 20 minutes;
149-
private exec(command: string, args: string[], options: { cwd: string, timeout?: number }): void {
149+
private exec(command: string, args: string[], options: { cwd: string }): void {
150150
const cp: typeof import("child_process") = require("child_process");
151151
const stdio = isWorker ? "pipe" : "inherit";
152-
const res = cp.spawnSync(command, args, { timeout: this.timeout, shell: true, stdio, ...options });
152+
const res = cp.spawnSync(isWorker ? `${command} 2>&1` : command, args, { timeout: this.timeout, shell: true, stdio, ...options });
153153
if (res.status !== 0) {
154-
throw new Error(`${command} ${args.join(" ")} for ${options.cwd} failed: ${res.stderr && res.stderr.toString()}`);
154+
throw new Error(`${command} ${args.join(" ")} for ${options.cwd} failed: ${res.stdout && res.stdout.toString()}`);
155155
}
156156
}
157157
report(result: ExecResult) {

0 commit comments

Comments
 (0)