Another technique would be to patch the devtools functions so that they allow you to pass the stdout argument to system2. Also not very elegant, but perhaps you could convince the package authors to modify devtools in this way. Here are my patched build and install functions:
library(devtools)
# New functions.
my.install<-function (pkg = ".", reload = TRUE, quick = FALSE, args = NULL, ...)
{
pkg <- as.package(pkg)
message("Installing ", pkg$package)
devtools:::install_deps(pkg)
built_path <- devtools:::build(pkg, tempdir(),...) # pass along the stdout arg
on.exit(unlink(built_path))
opts <- c(paste("--library=", shQuote(.libPaths()[1]), sep = ""),
"--with-keep.source")
if (quick) {
opts <- c(opts, "--no-docs", "--no-multiarch", "--no-demo")
}
opts <- paste(paste(opts, collapse = " "), paste(args, collapse = " "))
devtools:::R(paste("CMD INSTALL ", shQuote(built_path), " ", opts, sep = ""),...) # pass along the stdout arg
if (reload)
devtools:::reload(pkg)
invisible(TRUE)
}
my.build<-function (pkg = ".", path = NULL, binary = FALSE, ...)
{
pkg <- as.package(pkg)
if (is.null(path)) {
path <- dirname(pkg$path)
}
if (binary) {
cmd <- paste("CMD INSTALL ", shQuote(pkg$path), " --build",
sep = "")
ext <- if (.Platform$OS.type == "windows")
"zip"
else "tgz"
}
else {
cmd <- paste("CMD build ", shQuote(pkg$path), " --no-manual --no-resave-data",
sep = "")
ext <- "tar.gz"
}
devtools:::R(cmd, path, ...) # pass along the stdout arg
targz <- paste(pkg$package, "_", pkg$version, ".", ext, sep = "")
file.path(path, targz)
}
# Patch package.
unlockBinding("install", as.environment("package:devtools"))
unlockBinding("build", as.environment("package:devtools"))
assignInNamespace('install', my.install, ns='devtools', envir=as.environment("package:devtools"));
assignInNamespace('build', my.build, ns='devtools', envir=as.environment("package:devtools"));
lockBinding("install", as.environment("package:devtools"))
lockBinding("build", as.environment("package:devtools"))
# Run with no messages.
suppressMessages(install_github('ROAUth','duncantl',stdout=NULL))
Essentially, you pass along the ... in three places, twice in the install function, and once in the build function.