Skip to content

Commit

Permalink
Add comment about GetConsoleMode's return value
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jul 6, 2023
1 parent 24e44fd commit 81bf1c5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ pub fn set_virtual_terminal(use_virtual: bool) -> Result<(), ()> {
}

let mut original_mode: DWORD = 0;
// Return value of 0 means that the function failed:
// https://learn.microsoft.com/en-us/windows/console/getconsolemode#return-value
if GetConsoleMode(handle, &mut original_mode) == 0 {
// TODO: It would be prudent to get the error using `GetLastError` here.
return Err(());
}

Expand Down

0 comments on commit 81bf1c5

Please sign in to comment.