re-enable ansi support when externals break it (#3429)

This commit is contained in:
Darren Schroeder 2021-05-14 23:11:21 -05:00 committed by GitHub
parent 07760b4129
commit be2f66397b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,6 +213,13 @@ pub fn view_contents(
skip: Option<&Value>,
length: Option<&Value>,
) -> Result<(), Box<dyn std::error::Error>> {
// Some 'bad actor' binaries turn off ansi support so we need to make sure
// that ansi support is enabled in windows
#[cfg(windows)]
{
let _ = nu_ansi_term::enable_ansi_support();
}
let skip_bytes = skip.map(|s| s.as_usize().unwrap_or(0));
let num_bytes = length.map(|b| b.as_usize().unwrap_or(0));