Skip to content

util/process_wrapper: improve resilience to non-JSON output#4021

Open
th0br0 wants to merge 1 commit into
bazelbuild:mainfrom
th0br0:process_wrapper_non_json
Open

util/process_wrapper: improve resilience to non-JSON output#4021
th0br0 wants to merge 1 commit into
bazelbuild:mainfrom
th0br0:process_wrapper_non_json

Conversation

@th0br0
Copy link
Copy Markdown

@th0br0 th0br0 commented May 8, 2026

Make process_line in process_wrapper catch parsing failures and wrap non-JSON lines in valid JSON warnings.
This prevents crashes when rustc emits unexpected warnings.

@th0br0 th0br0 force-pushed the process_wrapper_non_json branch from f0d457b to 2ef5a58 Compare May 8, 2026 11:11
@scentini scentini requested a review from slackito May 8, 2026 11:23
Copy link
Copy Markdown
Collaborator

@slackito slackito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the general idea looks good. If I understand correctly, instead of looking for a particular pattern of output messages that should be converted to JSON warnings, now we look for strings that are likely JSON (if they start with a '{') and convert anything else to JSON warnings, right?

Pre-merge checks are failing, specifically //test/process_wrapper:rustc_quit_on_rmeta. Can you take a look?

format: ErrorFormat,
metadata_emitted: &mut bool,
) -> Result<LineOutput, String> {
// LLVM can emit lines that look like the following, and these will be interspersed
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're still trying to convert non-JSON lines to JSON so I think this comment explaining why we need to do that should be preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants