kennytm / cargo-kcov

Cargo subcommand to run kcov to get coverage report on Linux
127 stars 20 forks source link

thread 'main' panicked at 'Could not open stderr!' #5

Closed kswmsw closed 7 years ago

kswmsw commented 7 years ago

When running cargo kcov inside Gitlab CI, any failures are reported simply as

thread 'main' panicked at 'Could not open stderr!', ../src/libcore/option.rs:705
note: Run with `RUST_BACKTRACE=1` for a backtrace.

which is a bit unhelpful.

On closer examination, the issue is in errors.rs line 79 which does

let mut t = stderr().expect("Could not open stderr!");

which is actually term::stderr. If the terminal is not set up correctly, this returns None and panics.

Repro:

$ TERM=none cargo kcov --kcov xyz
thread 'main' panicked at 'Could not open stderr!', ../src/libcore/option.rs:705
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Please can cargo-kcov fall back to using stderr (without colouring) if stderr() fails?

Thanks.

Workaround: prefix the cargo command with TERM=ansi.

kennytm commented 7 years ago

Fixed in v0.3.1 for the repro case.

(cc Stebalien/term#57)

kswmsw commented 7 years ago

Awesome, thanks @kennytm !

kswmsw commented 7 years ago

Confirmed, this nicely fixes our issue. Thanks again.