|
1 | 1 | import { npath } from '@yarnpkg/fslib'; |
2 | 2 | import { execute } from '@yarnpkg/shell'; |
3 | 3 | import { randomUUID } from 'node:crypto'; |
4 | | -import fs from 'node:fs'; |
| 4 | +import fs, { readFileSync } from 'node:fs'; |
5 | 5 | import fsPromises from 'node:fs/promises'; |
| 6 | +import { open } from 'node:fs/promises'; |
6 | 7 | import { cpus, tmpdir } from 'node:os'; |
7 | 8 | import path from 'node:path'; |
8 | | -import { PassThrough } from 'node:stream'; |
9 | | -import { text } from 'node:stream/consumers'; |
10 | 9 | import { debuglog, parseArgs } from 'node:util'; |
11 | 10 |
|
12 | 11 | import { isPassThroughEnv, replaceUnstableOutput } from './utils'; |
@@ -153,18 +152,20 @@ async function runTestCase(name: string, tempTmpDir: string, casesDir: string) { |
153 | 152 | const cwd = npath.toPortablePath(caseTmpDir); |
154 | 153 | for (const command of steps.commands) { |
155 | 154 | debug('running command: %s, cwd: %s, env: %o', command, caseTmpDir, env); |
156 | | - const outputStream = new PassThrough(); |
| 155 | + const outpuStreamPath = path.join(caseTmpDir, 'output.log'); |
| 156 | + const outputStream = await open(outpuStreamPath, 'w'); |
157 | 157 |
|
158 | 158 | const exitCode = await execute(stripComments(command), [], { |
159 | 159 | env, |
160 | 160 | cwd, |
161 | 161 | stdin: null, |
162 | | - stderr: outputStream, |
163 | | - stdout: outputStream, |
| 162 | + stderr: outputStream as any, |
| 163 | + stdout: outputStream as any, |
164 | 164 | }); |
165 | 165 |
|
166 | | - outputStream.end(); |
167 | | - const output = await text(outputStream); |
| 166 | + outputStream.close(); |
| 167 | + |
| 168 | + const output = readFileSync(outpuStreamPath, 'utf-8'); |
168 | 169 |
|
169 | 170 | let commandLine = `> ${command}`; |
170 | 171 | if (exitCode !== 0) { |
|
0 commit comments