[Rd] system2 fails with quiet=TRUE, but runs through with quiet=FALSE

Johannes Rauh JARauh at web.de
Tue Dec 6 16:28:32 CET 2016


Hi,

I have recently tried to check the test coverage using library("covr") and, interestingly, the command

> covr::package_coverage()

fails, while

> covr::package_coverage(quiet = FALSE)

runs through without problem.  I traced the problem to a call to utils::install.packages(), where the option quiet is passed on.  In utils::install.packages(), the problem seems to lie in the following call of system2():

  output <- if (quiet)
    FALSE else ""
  [...]
  status <- system2(cmd0, args, env = env, stdout = output,
                        stderr = output)

Manually changing stdout to "" makes the program run through without error (but then the output is there again, of course...).

The function system2 seems to be a wrapper around

  .Internal(system(command, flags, f, stdout, stderr))

In this call, if quiet = TRUE, then flags <- 21, otherwise flags <- 22.  stdout and stderr are passed through from system2.

I should mention that I am working with R 3.3.1 on Windows 8.

Does anyone have an idea what the flags mean and how they can make a system call fail?

Best
Johannes



More information about the R-devel mailing list