diff --git a/src/lib.rs b/src/lib.rs index 19fc18ae710cecc2f0df0081c73c1c9ec50bd432..ac2fc2bf97df9e96062dca7d709046e6b1838298 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -176,6 +176,9 @@ impl<'out, 'prompt> State<'out, 'prompt> { #[cfg(windows)] fn refresh(&mut self, prompt: &str, prompt_size: Position) -> Result<()> { let handle = self.output_handle; + if cfg!(test) && handle.is_null() { + return Ok(()); + } // calculate the position of the end of the input line let end_pos = calculate_position(&self.line, prompt_size, self.cols); // calculate the desired position of the cursor @@ -1299,6 +1302,7 @@ mod test { #[cfg(windows)] fn default_handle() -> Handle { ::std::ptr::null_mut() + //super::get_std_handle(super::STDOUT_FILENO).expect("Valid stdout") } fn init_state<'out>(out: &'out mut Write,