Browse Source

play nicer when zdns can't be found initially

master
boB Rudis 4 years ago
parent
commit
27607208ca
  1. 10
      R/zdns-exec.R
  2. 20
      R/zzz.R

10
R/zdns-exec.R

@ -15,6 +15,14 @@ zdns_exec <- function(args=c(), stdout="", stdin="") {
zdns_bin <- Sys.which("zdns")
if (zdns_bin == "") {
message("zdns binary not on PATH. Trying to find it at ~/go/bin...")
zdns_bin <- path.expand("~/go/bin/zdns")
if (!file.exists(zdns_bin)) {
stop("zdns binary not found.", call.=FALSE)
}
}
res <- system2(zdns_bin, args=args, stdout=stdout, stdin=stdin)
invisible(res)
@ -25,4 +33,4 @@ zdns_exec <- function(args=c(), stdout="", stdin="") {
#' @export
zdns_help <- function(x) {
zdns_exec("--help")
}
}

20
R/zzz.R

@ -10,12 +10,22 @@
} else {
res <- Sys.which("zdns")
if (res == "") {
packageStartupMessage(
"zdns binary not found. Please go to https://github.com/zmap/zdns to find ",
"installation instructions or try running install_zdns() and/or ensure that .",
"$GOPATH/bin is on the system PATH reachable by R."
)
res <- path.expand("~/go/bin/zdns")
if (!file.exists(zdns_bin)) {
packageStartupMessage(
"zdns binary was not found automatically but was found in your local go 'bin'",
"diredctory. {zdnsr} will compensate for this but you should correct the PATH",
"configuration to avoid problems."
)
} else {
packageStartupMessage(
"zdns binary not found. Please go to https://github.com/zmap/zdns to find ",
"installation instructions or try running install_zdns() and/or ensure that .",
"$GOPATH/bin is on the system PATH reachable by R."
)
}
}
}

Loading…
Cancel
Save