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

Difficult to know when to stop parsing JSON messages. #7978

Closed
ehuss opened this issue Mar 8, 2020 · 1 comment · Fixed by #8069
Closed

Difficult to know when to stop parsing JSON messages. #7978

ehuss opened this issue Mar 8, 2020 · 1 comment · Fixed by #8069
Labels
A-json-output Area: JSON message output C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 8, 2020

Describe the problem you are trying to solve
It is currently difficult when parsing JSON messages to know when Cargo is finished. With cargo test or cargo run, additional things will be printed to stdout. Tools should scan for lines that start with { to detect JSON, but that doesn't help if the subsequent process also emits {.

Describe the solution you'd like
I think Cargo should emit some JSON message to indicate that it is finished. Tools can use this to know when to stop parsing. Or perhaps the message should be structured to indicate that Cargo is running an external process (with the path to the process). This may be complicated with tests since multiple tests will run (and would be good to have a story for how JSON test output works).

Either way, tools need some way to know when Cargo stops, and something else begins.

@ehuss ehuss added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` A-json-output Area: JSON message output labels Mar 8, 2020
@alexcrichton
Copy link
Member

I think this makes sense to do for a single-binary case like cargo run, but for cargo test I'd be worried about the multi-binary case as you've described. That'd probably make me lean a bit more toward "print we're running something" rather than "print the build is done". That would be a bit more flexible to running multiple binaries, and it also wouldn't have an odd message at the end of cargo build, only required messages on cargo run or cargo test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-json-output Area: JSON message output C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants