Fix problem with parsing output from different versions of dig
This commit is contained in:
parent
0207e365c7
commit
968e403307
|
|
@ -73,14 +73,18 @@ impl DigResponse {
|
||||||
);
|
);
|
||||||
if cmd.status.success() {
|
if cmd.status.success() {
|
||||||
Ok(serde_yaml_ng::from_str(
|
Ok(serde_yaml_ng::from_str(
|
||||||
String::from_utf8(cmd.stdout.into_iter().skip(2).collect())
|
String::from_utf8(if cmd.stdout.starts_with(b"-\n") {
|
||||||
// we skip two here --------------------------^
|
cmd.stdout.into_iter().skip(2).collect()
|
||||||
// because the dig output starts with "-\n" which fails to parse.
|
} else {
|
||||||
.map_err(|error| {
|
cmd.stdout
|
||||||
error!(domain:?, error:?; "couldn't convert command output to a string");
|
})
|
||||||
error
|
// we skip two here --------------------------^
|
||||||
})?
|
// because the dig output starts with "-\n" which fails to parse.
|
||||||
.as_str(),
|
.map_err(|error| {
|
||||||
|
error!(domain:?, error:?; "couldn't convert command output to a string");
|
||||||
|
error
|
||||||
|
})?
|
||||||
|
.as_str(),
|
||||||
)?)
|
)?)
|
||||||
} else {
|
} else {
|
||||||
error!(status:? = cmd.status,
|
error!(status:? = cmd.status,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue