system2 fails with quiet=TRUE, but runs through with quiet=FALSE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

system2 fails with quiet=TRUE, but runs through with quiet=FALSE

Johannes Rauh
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel