Skip to content

Commit

Permalink
apply latest three bug fixes to Windows code (getting there)
Browse files Browse the repository at this point in the history
  • Loading branch information
apparebit committed Nov 12, 2024
1 parent f48487a commit 4428cab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/term/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Config {
// If the update fails, try to restore old configuration.
this.update(new_input_mode, new_output_mode).or_else(|e| {
this.restore();
e
Err(e)
})?;

Ok(this)
Expand All @@ -164,7 +164,8 @@ impl Config {
let result3 = Self::write_mode(self.handle.output(), self.output_mode);
let result4 = unsafe { Console::SetConsoleOutputCP(self.output_encoding) }.into_result();

result1.and(result2).and(result3).and(result4)
result1.and(result2).and(result3).and(result4)?;
Ok(())
}

// ------------------------------------------------------------------------------------------------------
Expand All @@ -176,7 +177,8 @@ impl Config {
}

fn write_mode(handle: RawHandle, mode: ConsoleMode) -> Result<()> {
unsafe { Console::SetConsoleMode(handle, mode) }.into_result()
unsafe { Console::SetConsoleMode(handle, mode) }.into_result()?;
Ok(())
}
}

Expand Down

0 comments on commit 4428cab

Please sign in to comment.