Fix problem with parsing output from different versions of dig
This commit is contained in:
parent
0207e365c7
commit
968e403307
|
|
@ -73,7 +73,11 @@ 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") {
|
||||||
|
cmd.stdout.into_iter().skip(2).collect()
|
||||||
|
} else {
|
||||||
|
cmd.stdout
|
||||||
|
})
|
||||||
// we skip two here --------------------------^
|
// we skip two here --------------------------^
|
||||||
// because the dig output starts with "-\n" which fails to parse.
|
// because the dig output starts with "-\n" which fails to parse.
|
||||||
.map_err(|error| {
|
.map_err(|error| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue