Fix bug with new dig format
This commit is contained in:
parent
6e8c5d927b
commit
965a9d0724
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
/target
|
||||
result-bin
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl DigResponse {
|
|||
pub fn query(domain: impl AsRef<str>) -> anyhow::Result<Self> {
|
||||
let domain = domain.as_ref();
|
||||
let start = Instant::now();
|
||||
let cmd = Command::new("dig")
|
||||
let mut cmd = Command::new("dig")
|
||||
.arg("+yaml")
|
||||
.arg(domain)
|
||||
.output()
|
||||
|
|
@ -76,7 +76,9 @@ impl DigResponse {
|
|||
String::from_utf8(if cmd.stdout.starts_with(b"-\n") {
|
||||
cmd.stdout.into_iter().skip(2).collect()
|
||||
} else {
|
||||
cmd.stdout
|
||||
let stdout = cmd.stdout.as_mut_slice();
|
||||
stdout[0] = b' ';
|
||||
stdout.to_vec()
|
||||
})
|
||||
// we skip two here --------------------------^
|
||||
// because the dig output starts with "-\n" which fails to parse.
|
||||
|
|
|
|||
Loading…
Reference in a new issue