Allow output of rustdoc-json to be captured.
Hi @Enselic. This PR allows users to capture the std{out,err} of rustdoc, which is something I need to do in cargo-rdme.
Let me know what you think.
Hi orium. I'm not against doing something like this if it is needed, but I'd like to understand more about why it's needed. Can you explain in more detail in what way you plan to use this new API please?
Can you explain in more detail in what way you plan to use this new API please?
Yes: basically I want to rustdoc to not output anything at all unless the rustdoc build failed. In that case I want to present a error of my own and provide the rustdoc stderr.
I've implemented like I discussed in https://github.com/Enselic/cargo-public-api/pull/574#discussion_r1599059467. Didn't introduce a new pub function for "build and capture", simply just added Builder::build_capture_output().
The phrase "see stderr" is in my mind short for "see stderr, regardless of it is printed in your terminal or if you captured it yourself".
Ok, I wasn't reading in that way, but that makes sense.
Feel free to squash my commits into your commit without attribution to me.
Squashed.
I did a more detailed review and inlined a function and made the CI failure pass. But it looks like your test fails too.
Thanks for fixing custom_toolchain_via_proxy. My test was failing because the github's CI tty somehow makes cargo color the output, which doesn't happen when I run the test in my machine. I could just strip colors from the output, but actually this is something we want users to be able to control, so I've added Builder::color() to control that.
(I've been unusually busy in recent days, hence the slow reply.)
No problem at all!
I added some more error enums (feel free to squash with your commit without attribution.
Given that your commit contains non-trivial changes I think it makes sense to preserve it.
It would also be good to rebase on dependabot commits)
Rebased.
I tried to get used to the terminology of "CrateBuildError" for failure to build rustdoc JSON, but I think that has too strong association to "cargo build", which is not what rustdoc JSON is using. So I renamed it to "BuildRustdocJsonError". Is that OK with you?
Yeah, happy with that.
Thank you! Looking forward for the release. Cheers!
Released as v0.9.1 🚀
(You will be credited by name next time I do a cargo-public-api release, but that might take a while)
That's great. Thank you!