trycmd
trycmd copied to clipboard
Handle jsonlines being mixed with other output
Cargo needs this for testing cargo test. This was found while testing the fix for #348.
Could you point out the specific tests needing this?
https://github.com/rust-lang/cargo/blob/7f2079838ac6e0a3cb05b1b9dac4401a76572855/tests/testsuite/test.rs#L4365-L4420
We could look into other ways of solving that but I hadn't yet
- Could we pass
--no-run? - We could read the output and do our own filtering before doing a direct call to
assert_e2e().eq
--no-run seems like a viable solution for Cargo. In an ideal world everything should be JSON under --message-forma=json. I don't really think snapbox is responsible for this misfortune.
I don't really think snapbox is responsible for this misfortune.
If only the world was so clean.
For example, I was looking at cargo's compilation for other reasons and cargo emits json on stderr and we only parse lines starting as { as json, forwarding the rest on to stderr.
rust-lang/cargo#14297 dropped the priority of this