Unverified Commit 889481e8 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update delayed test output handling (#39078)

parent 34f5236f
...@@ -269,15 +269,15 @@ async function main() { ...@@ -269,15 +269,15 @@ async function main() {
}, },
} }
) )
const handleOutput = (chunk) => { const handleOutput = (type) => (chunk) => {
if (hideOutput) { if (hideOutput) {
outputChunks.push(chunk) outputChunks.push({ type, chunk })
} else { } else {
process.stderr.write(chunk) process.stderr.write(chunk)
} }
} }
child.stdout.on('data', handleOutput) child.stdout.on('data', handleOutput('stdout'))
child.stderr.on('data', handleOutput) child.stderr.on('data', handleOutput('stderr'))
children.add(child) children.add(child)
...@@ -287,15 +287,13 @@ async function main() { ...@@ -287,15 +287,13 @@ async function main() {
if (isFinalRun && hideOutput) { if (isFinalRun && hideOutput) {
// limit out to last 64kb so that we don't // limit out to last 64kb so that we don't
// run out of log room in CI // run out of log room in CI
const trimmedOutput = [] outputChunks.forEach(({ type, chunk }) => {
if (type === 'stdout') {
for (let i = outputChunks.length; i >= 0; i--) { process.stdout.write(chunk)
const chunk = outputChunks[i] } else {
if (!chunk) continue process.stderr.write(chunk)
trimmedOutput.unshift(chunk)
} }
trimmedOutput.forEach((chunk) => process.stdout.write(chunk)) })
} }
return reject( return reject(
new Error( new Error(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment