fern icon indicating copy to clipboard operation
fern copied to clipboard

ColoredLevelConfig::new() fails to compile on Windows

Open braxtons12 opened this issue 5 years ago • 2 comments

Compiling on Windows with Rust stable v1.42.0 and fern = { version = "^0.6", features = ["colored"] }

gives:

error[E0425]: cannot find function `set_virtual_terminal` in module `colored::control`
   --> C:\Users\braxton\.cargo\registry\src\github.com-1ecc6299db9ec823\fern-0.6.0\src\colors.rs:161:39
    |
161 |             let _ = colored::control::set_virtual_terminal(true);
    |                                       ^^^^^^^^^^^^^^^^^^^^ not found in `colored::control

That section of your code is:

    #[inline]
    pub fn new() -> Self {
        #[cfg(windows)]
        {
            let _ = colored::control::set_virtual_terminal(true);
        }
        Self::default()
    }

And after looking over the colored crate, there's indeed nothing even resembling that in that module. Perhaps this should be colored::control::set_override(true);?

braxtons12 avatar Apr 13 '20 01:04 braxtons12

Huh, weird. I believe it should exist, but if you're looking at the default docs.rs documentation it will be built for linux, and exclude the function. Here's what I've looked at which shows its existence: https://docs.rs/colored/1.9.3/x86_64-pc-windows-msvc/colored/control/fn.set_virtual_terminal.html

To be honest I have been neglecting windows a bit - I don't have a local computer to test on. There are CI tests, but they're also imperfect, and it obviously didn't catch this.

Could you give me more information on the toolchain you're using, or possibly try to build colored docs locally and see if the function shows up?

daboross avatar May 11 '20 12:05 daboross

I was/am using the standard stable toolchain for Windows, rust installed via rustup, x86_64-pc-windows-msvc, etc.

Haven't touched the project since filing this issue (it's a pet project and have had other things to work on, so it was fine letting it sit), but apparently now this has resolved itself?

Not sure what could have change between now and a month ago without either of us doing anything. Maybe something in the cargo cache was corrupted and was since somehow resolved? shrugs

braxtons12 avatar May 11 '20 18:05 braxtons12