r-lib / rcmdcheck

Run R CMD check from R and collect the results
https://rcmdcheck.r-lib.org
Other
115 stars 27 forks source link

Can't run rcmdcheck on a different version of R #226

Open MichaelChirico opened 2 months ago

MichaelChirico commented 2 months ago

rcmdcheck() appears to always take the version of R from the calling session, with no way to override this by setting R_HOME:

system("/usr/local/bin/Rscript -e 'rcmdcheck::rcmdcheck(...)'")
# ─  using R version 4.4.0 (2024-04-24)
system("/usr/local/bin/Rscript -e 'rcmdcheck::rcmdcheck(..., env=c(R_HOME=\"/path/to/rdevel\")'")
#    WARNING: ignoring environment value of R_HOME
# ─  using R version 4.4.0 (2024-04-24)

system("/path/to/rdevel/bin/Rscript -e 'rcmdcheck::rcmdcheck(...)'")
# ─  using R Under development (unstable) (2024-08-16 r87026)
system("/path/to/rdevel/bin/Rscript -e 'rcmdcheck::rcmdcheck(..., env=c(R_HOME=\"/usr/local\")'")
#    WARNING: ignoring environment value of R_HOME
# ─  using R Under development (unstable) (2024-08-16 r87026)

Am I perhaps doing something wrong? I can of course call rcmdcheck() in a subprocess, but it would be nice to easily write res <- rcmdcheck(...); process(res) in the current session (without needing {callr}).

gaborcsardi commented 2 months ago

Indeed, rcmdcheck runs R CMD check in the same R version, by design.