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() {
},
}
)
const handleOutput = (chunk) => {
const handleOutput = (type) => (chunk) => {
if (hideOutput) {
outputChunks.push(chunk)
outputChunks.push({ type, chunk })
} else {
process.stderr.write(chunk)
}
}
child.stdout.on('data', handleOutput)
child.stderr.on('data', handleOutput)
child.stdout.on('data', handleOutput('stdout'))
child.stderr.on('data', handleOutput('stderr'))
children.add(child)
......@@ -287,15 +287,13 @@ async function main() {
if (isFinalRun && hideOutput) {
// limit out to last 64kb so that we don't
// run out of log room in CI
const trimmedOutput = []
for (let i = outputChunks.length; i >= 0; i--) {
const chunk = outputChunks[i]
if (!chunk) continue
trimmedOutput.unshift(chunk)
}
trimmedOutput.forEach((chunk) => process.stdout.write(chunk))
outputChunks.forEach(({ type, chunk }) => {
if (type === 'stdout') {
process.stdout.write(chunk)
} else {
process.stderr.write(chunk)
}
})
}
return reject(
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