Open HenrikBengtsson opened 6 years ago
Don't forget R.utils::queryRCmdCheck()
which does something similar.
Adding
utils::str(list(
cmdargs = commandArgs(),
R_CMD = Sys.getenv("R_CMD")
), vec.len = +Inf)
to ~/.Rprofile
reveals that calls to R CMD build ...
, R CMD check ...
and R CMD INSTALL ...
carry the following information:
On Windows:
C:\Users\hb> R CMD build --help
List of 2
$ cmdargs: chr [1:9] "C:\\PROGRA~1\\R\\R-36~1.3/bin/x64/Rterm.exe" "-e" "tools:::.build_packages()" "R_DEFAULT_PACKAGES=" "LC_COLLATE=C" "--no-restore" "--slave" "--args" "nextArg--help"
$ R_CMD : chr "R CMD"
$ stdin : chr [1:2] "tools:::.build_packages()" ""
C:\Users\hb> R CMD check --help
List of 2
$ cmdargs: chr [1:9] "C:\\PROGRA~1\\R\\R-36~1.3/bin/x64/Rterm.exe" "-e" "tools:::.check_packages()" "R_DEFAULT_PACKAGES=" "LC_COLLATE=C" "--no-restore" "--slave" "--args" "nextArg--help"
$ R_CMD : chr "R CMD"
$ stdin : chr [1:2] "tools:::.check_packages()" ""
C:\Users\hb>R CMD INSTALL --help
List of 3
$ cmdargs: chr [1:9] "C:\\PROGRA~1\\R\\R-36~1.3/bin/x64/Rterm.exe" "-e" "tools:::.install_packages()" "R_DEFAULT_PACKAGES=" "LC_COLLATE=C" "--no-restore" "--slave" "--args" "nextArg--help"
$ R_CMD : chr "R CMD"
$ stdin : chr [1:2] "tools:::.install_packages()" ""
On Linux:
$ R CMD build --help
List of 2
$ cmdargs: chr [1:5] "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/exec/R" "--no-restore" "--no-echo" "--args" "nextArg--help"
$ R_CMD : chr "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/Rcmd"
$ stdin : chr "tools:::.build_packages()"
$ R CMD check --help
List of 2
$ cmdargs: chr [1:5] "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/exec/R" "--no-restore" "--no-echo" "--args" "nextArg--help"
$ R_CMD : chr "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/Rcmd"
$ stdin : chr "tools:::.check_packages()"
$ R CMD INSTALL --help
List of 3
$ cmdargs: chr [1:5] "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/exec/R" "--no-restore" "--no-echo" "--args" "nextArg--help"
$ R_CMD : chr "/home/hb/software/R-devel/R-4-0-branch/lib/R/bin/Rcmd"
$ stdin : chr "tools:::.install_packages()"
Is it possible to detect/infer, during
.Rprofile
, whetherR CMD check
is running or not? (I'd expectcommandArgs()
would reflect this)If so, we could add an element to
startup::sysinfo()
that reflects this, e.g. stringr_cmd
taking valuesbuild
,INSTALL
, andcheck
.And then, one could add a "hook" that reports on more information about the R session that what
R CMD check
reports on, e.g. what environment variables, locales, R options,.libPaths()
etc.R CMD check
sees. This info could be outputted to a log file in the check directory but possibly also be outputted to the terminal (unlessR CMD ...
redirects all that).