[bazel] on CI, log buffered log lines that start with INFO: (#136981)

This commit is contained in:
Spencer 2022-07-22 12:03:28 -07:00 committed by GitHub
parent 4b52441a53
commit 757001f3c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ function once(emitter, event) {
* @param {import('./types').BazelRunOptions | undefined} options
*/
async function runBazelRunner(runner, args, options = undefined) {
const proc = ChildProcess.spawn(runner, args, {
const proc = ChildProcess.spawn(runner, options?.quiet ? [...args, '--color=no'] : args, {
env: {
...process.env,
...options?.env,
@ -101,6 +101,15 @@ async function runBazelRunner(runner, args, options = undefined) {
}),
]),
]);
if (process.env.CI) {
// on CI it's useful to reduce the logging output, but we still want to see basic info from Bazel so continue to log the INFO: lines from bazel
for (const line of buffer) {
if (line.startsWith('INFO:') && !line.startsWith('INFO: From ')) {
console.log(options?.logPrefix ? `${options.logPrefix} ${line}` : line);
}
}
}
}
/**