Closed hadley closed 2 months ago
I was seeing something similar, but only when devtools::check()
is invoked.
For example, if I call devtools::check()
in the console, or if I run the check in the RStudio Build pane with Project Options > Build Tools > Use devtools package functions if available
checked, then I get similar formatting issues:
Alternatively, if I call rcmdcheck::rcmdcheck()
in the console, or I run the check in the RStudio Build pane with Project Options > Build Tools > Use devtools package functions if available
unchecked, then the formatting is correct:
Looking a bit further, devtools::check()
sets some of the arguments when calling rcmdcheck::rcmdcheck()
- working from here, it appears as though the formatting issue is linked to the use of "--as-cran"
. For example, rcmdcheck::rcmdcheck(args="--as-cran")
will have the formatting issues present.
Hope this digging helps work out what is causing the bug! :)
Digging further again, it looks like it is to do with how the stdout
is formatted during the call to callr::rcmd_safe()
.
If the cmdargs
argument contains --as-cran
, then the formatting bug appears in rcmdcheck()
, independent of whether detect_callback()
uses as_cran = TRUE
or as_cran = FALSE
.
Below are the raw test-related parts of stdout
:
With --as-cran
:
* checking for unstated dependencies in 'tests' ... OK\r\n* checking tests ...\r\n Running 'spelling.R'\r\n Running 'testthat.R' [20s]\r\n [20s] OK\r\n* checking for unstated dependencies in vignettes ... OK\r\n
Without --as-cran
:
* checking for unstated dependencies in 'tests' ... OK\r\n* checking tests ...\r\n Running 'spelling.R'\r\n Running 'testthat.R'\r\n OK\r\n* checking for unstated dependencies in vignettes ... OK\r\n
I suspect it is the appearance of [20s] OK\r\n
which is causing the issue - this is also present if R CMD check --as-cran
is run in the terminal, so I suspect that block_callback()
will need to be modified to handle this stdout
return.
@stephenashton-dhsc thanks for digging into this!
But it looks fine if I run
rcmdcheck::rcmdcheck()
in the console 😞