Skip to content

Commit

Permalink
freezer: fix the issue of missing trim the str
Browse files Browse the repository at this point in the history
When reading from the freezer file, it should trim it
first, and the string may container an '\n'.

Fixes: #48

Signed-off-by: fupan.lfp <[email protected]>
  • Loading branch information
fupan.lfp committed Jun 30, 2021
1 parent 45b626e commit 8d38596
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/freezer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl FreezerController {
let mut s = String::new();
let res = file.read_to_string(&mut s);
match res {
Ok(_) => match s.as_ref() {
Ok(_) => match s.trim().as_ref() {
"FROZEN" => Ok(FreezerState::Frozen),
"THAWED" => Ok(FreezerState::Thawed),
"1" => Ok(FreezerState::Frozen),
Expand Down

0 comments on commit 8d38596

Please sign in to comment.