Open asvrada opened 6 days ago
We do not guarantee output in any particular shell-compatible format except for --export-prefix (which is for the UNIX shell), so I think the solution here is to add a flag for PowerShell equivalent to --export-prefix.
Hi @taiki-e I want to take a look at this issue this weekend, probably by adding a new option like --ps-env-prefix
. Could you point me to the relevant file as a starting point?
Main related files are cli.rs, which parses the flags, and ShowEnvWriter in main.rs, which does the actual output.
A search of the existing code with export[_-]prefix
should show all related locations: https://github.com/search?q=repo%3Ataiki-e%2Fcargo-llvm-cov+%2Fexport%5B_-%5Dprefix%2F&type=code
What's the issue
cargo llvm-cov show-env
would print non-printable characters (0x1f
ASCII Unit Separator), and PowerShell can't handle them.For example I am building a DLL on Windows that needs to follow Get coverage of external tests.
And I am using below PowerShell script to set the env variable
If I ran this script and check
$env:CARGO_ENCODED_RUSTFLAGS
, I would getIf I directly run
cargo llvm-cov show-env
, I would getThe ▼ is supposed to be
0x1f
ASCII Unit Separator, as indicated by cargo doc here(search for CARGO_ENCODED_RUSTFLAGS). But according to this stackoverflow answer, PowerShell can't handle binary data