From be2f66397bf280f0a281d3fc8d8cd8340950eb5e Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 14 May 2021 23:11:21 -0500 Subject: [PATCH] re-enable ansi support when externals break it (#3429) --- crates/nu_plugin_binaryview/src/binaryview.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/nu_plugin_binaryview/src/binaryview.rs b/crates/nu_plugin_binaryview/src/binaryview.rs index d05ee5243c..71b8f6a8b9 100644 --- a/crates/nu_plugin_binaryview/src/binaryview.rs +++ b/crates/nu_plugin_binaryview/src/binaryview.rs @@ -213,6 +213,13 @@ pub fn view_contents( skip: Option<&Value>, length: Option<&Value>, ) -> Result<(), Box> { + // 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));