nixenv: ignore empty lines

This commit is contained in:
Graham Christensen 2020-03-30 16:23:49 -04:00
parent b50bc35026
commit 13ea5fded4
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -42,6 +42,7 @@ impl HydraNixEnv {
.lines() .lines()
.collect::<Result<Vec<String>, _>>()? .collect::<Result<Vec<String>, _>>()?
.into_iter() .into_iter()
.filter(|msg| msg.trim().len() > 0)
.filter(|msg| !is_user_setting_warning(msg)) .filter(|msg| !is_user_setting_warning(msg))
.collect::<Vec<String>>(); .collect::<Vec<String>>();
@ -174,6 +175,7 @@ impl Error {
} }
fn is_user_setting_warning(line: &str) -> bool { fn is_user_setting_warning(line: &str) -> bool {
let line = line.trim();
line.starts_with("warning: ignoring the user-specified setting '") line.starts_with("warning: ignoring the user-specified setting '")
&& line.ends_with("because it is a restricted setting and you are not a trusted user") && line.ends_with("because it is a restricted setting and you are not a trusted user")
} }