Skip to content

Commit 6a7556a

Browse files
committed
Handle drun stdin lines being invalid utf8
1 parent ae5acbc commit 6a7556a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ impl State {
6767
let stdin = std::io::stdin();
6868
let mut lines = Vec::new();
6969
for line in stdin.lines() {
70-
lines.push(line.expect("Can read line from stdin"));
70+
if let Ok(line_ok) = line {
71+
lines.push(line_ok);
72+
} else {
73+
log::warn!(
74+
"Line was not valid utf8!! {:?}",
75+
line.expect_err("unreachable")
76+
)
77+
}
7178
}
7279
Box::new(Drun::new(lines))
7380
}),

0 commit comments

Comments
 (0)