Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: tools should only interpret a line starting with { as JSON #14677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

weihanglo
Copy link
Member

What does this PR try to resolve?

Minor doc improvement that helps #8179

How should we test and review this PR?

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Oct 11, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 11, 2024
Comment on lines 49 to 54
> **Note:** Not all output is guaranteed to be in JSON format with the `--message-format=json` option.
> For example, output from procedural macros and logs from external tools may appear in plain text.
> Tools should only interpret a line as JSON if it starts with `{`.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer we don't bless mixed output as much as this makes it sound like it.

Maybe instead

Suggested change
> **Note:** Not all output is guaranteed to be in JSON format with the `--message-format=json` option.
> For example, output from procedural macros and logs from external tools may appear in plain text.
> Tools should only interpret a line as JSON if it starts with `{`.
> **Note:** `--message-format=json` only controls Cargo and Rustc's output. This cannot control the output of other tools, e.g. `cargo run --message-format=json`. A possible workaround in these situations is to only interpret a line as JSON if it starts with `{`.

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied your suggestion with a mention of proc macros. I think it is still worth since proc macros are not seen as “other tools” and people may not realize immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants