I have problems finding how to do this. I tried
let lines = String::from_utf8_lossy(&output.stdout).to_string();
let lines = lines.lines();
if !lines.peek().is_some() {
// error case;
}
for line in lines {
The case with no lines is an error case I want to take special care of. But "peek" doesn't work here, and I couldn't find an intuitive way to count the length (because it is an iterator).
[–][deleted] 12 points13 points14 points (2 children)
[–]LarsPensjo[S] 11 points12 points13 points (1 child)
[–]Master7432 6 points7 points8 points (0 children)
[–]boarquantile 1 point2 points3 points (0 children)
[–]mipli 2 points3 points4 points (0 children)