From ee3856d431e1147fc16929b0e5ac0123763b877c Mon Sep 17 00:00:00 2001 From: gwenn <gtreguier@gmail.com> Date: Sun, 10 Jul 2016 17:49:33 +0200 Subject: [PATCH] Fix test on windows --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 19fc18ae..ac2fc2bf 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, -- GitLab