Commit 8421a8b2 authored by Andreas Tille's avatar Andreas Tille

New upstream version 3.1.1

parent 28232217
Package: callr
Title: Call R from R
Version: 3.1.0
Version: 3.1.1
Authors@R: c(
person("Gábor", "Csárdi", role = c("aut", "cre", "cph"),
email = "csardi.gabor@gmail.com",
......@@ -17,14 +17,14 @@ URL: https://github.com/r-lib/callr#readme
BugReports: https://github.com/r-lib/callr/issues
RoxygenNote: 6.1.1
Imports: processx (>= 3.2.1), R6, utils
Suggests: covr, crayon, pingr, ps, testthat, withr
Suggests: cliapp, covr, crayon, pingr, ps, testthat, withr
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2018-12-10 14:39:29 UTC; gaborcsardi
Packaged: 2018-12-20 21:16:33 UTC; gaborcsardi
Author: Gábor Csárdi [aut, cre, cph] (<https://orcid.org/0000-0001-7098-9676>),
Winston Chang [aut],
RStudio [cph, fnd],
Mango Solutions [cph, fnd]
Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
Repository: CRAN
Date/Publication: 2018-12-10 16:30:03 UTC
Date/Publication: 2018-12-21 09:40:07 UTC
db5c02d4da2a83788cd1ffa79ba38cc9 *DESCRIPTION
4e42f791829dfc35e5dfb749793d9aae *DESCRIPTION
09079911e7389192b5cd3b99be725742 *LICENSE
9b5d730f348676cd2da2f43a5e49abc9 *NAMESPACE
f34c1382c01729405e82daa4b83ffe5d *NEWS.md
24e5e4ca5856fff63c861d500e53bfc2 *NAMESPACE
40ed6ce3f0fd4d1e2c1e259935b2507b *NEWS.md
3b8df834241438270bbf7789a1e670e5 *R/check.R
1af981d73baf2d14f3ef0f2137c94fa1 *R/error.R
c3b380b89b141bccb1497c1d30f303d4 *R/eval-bg.R
c1b5de325780c03585b2183b94c77cb3 *R/eval.R
7f7d31f2c380f434b7df7fed8f621dad *R/options.R
3785528cfb0a4a696051531cfb969660 *R/eval-bg.R
56a58111591be23a14dff0d032a4d235 *R/eval.R
fb28ac7d9d3ff5c05f85425b201cca47 *R/options.R
64ed8bccfa64793e18d7ebfe0648035d *R/package.R
287105f0398b809261129caf623099a2 *R/presets.R
57e46eb271bbc3020eb4c7bf45fa5625 *R/processx-forward.R
c6b2cc5c2bb8cb2c41c4463961f0e891 *R/r-process.R
ab72c20bd8714a520bc20d38554a1b86 *R/r-session.R
492ace42f036cb6c19fa0bbac475bab7 *R/rcmd-bg.R
1d6fd80745958733d9fd8f6ca0ae235a *R/r-session.R
1daa62af0f160748b8866b2f13b70d53 *R/rcmd-bg.R
ac0b96810f7a928532423ed52b6f2390 *R/rcmd-process.R
ab779e251cecc567918064d651753760 *R/rcmd.R
c9fac6a5d3dc97e6ae5c7aae0f0e8d70 *R/rcmd.R
094e25fc622caa2b6e648649fa0abdd5 *R/result.R
836cf23ce4b08535c487053279e64807 *R/rscript.R
4d14d6922220c8bd3a773d4c2909264e *R/rscript.R
2988a2a6304870a9c2c2028eb33744d6 *R/run.R
f8567ebbf4fe1daea49f181cfb43632c *R/script.R
d18cfab13025dcad4c10e19b917ed579 *R/script.R
4d4d9c1af773ef4baa719eabf572b435 *R/setup.R
66a9f1c6f89241f176da37a14de128fd *R/utils.R
9fa1dd716eea99e8276ba8f926a276a3 *R/utils.R
66254ea46a2c6de87c96fb473abc7fa7 *README.md
5d976bfc318cf5c59663c744e47d88fc *inst/_pkgdown.yml
f016ae44474fd10d44cef6ccaf294913 *inst/developer-notes.md
b09aaab293cfd614e879088f0dc1dc7a *man/callr.Rd
66b8df108030a8f7d6857033105fc6ed *man/convert_and_check_my_args.Rd
88d3e9765ac8330eefe6b15b68b3ee75 *man/default_repos.Rd
e1d2ff482272edf64625401172e8cc55 *man/get_result.Rd
0f9ded268d665d0d91b2cf0fd8e9b0e1 *man/make_error.Rd
4acd53082ca5746117729cc5927941f4 *man/r.Rd
0a7fb3f0bd04fc662c7995acdf9a65f4 *man/r_bg.Rd
d06adce797c66120d21041f15920b6c7 *man/r.Rd
9a81d7f1a06c511cba5239a2631e808d *man/r_bg.Rd
b41d95309274bf484a504b3bffc790c5 *man/r_copycat.Rd
35bff037030eee6812a75363c8e2ef8a *man/r_process.Rd
0ba68b24099710b8a7257b172cfb8d26 *man/r_process_options.Rd
2152fb4adef4a21047f2f6f7f8e1b98a *man/r_session.Rd
9e6c8b3c124a3cc11c1a22e09c6eff18 *man/r_session_options.Rd
6f298a47213c3c8d11e3c84db00a368e *man/r_vanilla.Rd
15e8ec1f1dc2bedabc2fa296eeb1fddb *man/rcmd.Rd
c0e95376f0408f14c2562893ed867994 *man/rcmd_bg.Rd
c277b5550939797a211027c1efb922af *man/rcmd.Rd
19b442cae745d22b3d7583bdbc19a6b9 *man/rcmd_bg.Rd
3b158befa6e81b7c7d28a5dc96852a05 *man/rcmd_copycat.Rd
37660d882885c8f3305461b94b0de97c *man/rcmd_process.Rd
650bef3bdd486a28306d18e16fd7072c *man/rcmd_process_options.Rd
02f6dd5befd0a1c75a77c1d2e2c0c329 *man/rcmd_safe.Rd
6c0cbcbf7caeedd1c9652ca12c6a24ae *man/reexports.Rd
90bb870e4fe849fc7d2ba3fcff487bdb *man/rscript.Rd
28c942be00e0cbbf8bb17f18a4a8a967 *man/rscript.Rd
56fbcbbbc353e73e00fd42b8643ff2bc *man/rscript_process.Rd
6725f7b56f6004b3085ff7c8fa7445a9 *man/rscript_process_options.Rd
21063dd0748715689b464ecc0d7ec24a *tests/testthat.R
......@@ -55,6 +56,7 @@ c6cacb5cba2d4b2a8f9f55bdea4ee535 *tests/testthat/test-bugs.R
10617e1f5696167ea7a5531163941186 *tests/testthat/test-error.R
6098d2a68fb157f6129ce60c65f5bf16 *tests/testthat/test-eval.R
7bccd442c1ecdffef8f5db2e26bddf76 *tests/testthat/test-libpath.R
b449ceb9f6cd86e817ee1d0557e4d4f8 *tests/testthat/test-messages.R
29b792e646d8d54d5d041e4d4ca23b1f *tests/testthat/test-options.R
800ce9ab678d824030049d71611baa07 *tests/testthat/test-presets.R
a763a4c85e136d9b6d3c853b3cfa4c5e *tests/testthat/test-quit.R
......@@ -67,4 +69,4 @@ d9c0068b834d3c37dc0ba4dbbd03dbf9 *tests/testthat/test-r-session.R
b0ed8d838583b2339f653371d22f1422 *tests/testthat/test-rcmd.R
3235a33146e3ad0396db6ff20aedfaaa *tests/testthat/test-rscript.R
ea6ca0aafbc98da55e00772add24ce55 *tests/testthat/test-timeout.R
d5be47cd9f3b2407f466c2223d157153 *tests/testthat/test-utils.R
35e5520c782d5a119d0b70f462417f31 *tests/testthat/test-utils.R
# Generated by roxygen2: do not edit by hand
export(default_repos)
export(poll)
export(process)
export(r)
......
# 3.1.1
* `r()`, `r_bg()`, etc. now handle messages from the cliapp package
properly. They used to make the R session exit.
* Better default for the `repos` option in callr subprocesses. callr no
longer creates duplicate "CRAN" entries. By default the new
`default_repos()` function is used to set `repos` in the subprocess.
# callr 3.1.0
* New `rscript()` function and `rscript_process` class to execute
......
......@@ -24,8 +24,7 @@
#' }
r_bg <- function(func, args = list(), libpath = .libPaths(),
repos = c(getOption("repos"),
c(CRAN = "https://cloud.r-project.org")),
repos = default_repos(),
stdout = "|", stderr = "|",
poll_connection = TRUE,
error = getOption("callr.error", "error"),
......
......@@ -120,8 +120,7 @@
#' @export
r <- function(func, args = list(), libpath = .libPaths(),
repos = c(getOption("repos"),
c(CRAN = "https://cloud.r-project.org")),
repos = default_repos(),
stdout = NULL, stderr = NULL,
poll_connection = TRUE,
error = getOption("callr.error", "error"),
......
......@@ -65,7 +65,7 @@ r_process_options_default <- function() {
func = NULL,
args = list(),
libpath = .libPaths(),
repos = c(getOption("repos"), CRAN = "https://cloud.r-project.org"),
repos = default_repos(),
stdout = "|",
stderr = "|",
poll_connection = TRUE,
......@@ -87,7 +87,7 @@ rcmd_process_options_default <- function() {
stdout = "|",
stderr = "|",
poll_connection = TRUE,
repos = c(getOption("repos"), CRAN = "https://cloud.r-project.org"),
repos = default_repos(),
system_profile = FALSE,
user_profile = FALSE,
env = rcmd_safe_env(),
......@@ -104,7 +104,7 @@ rscript_process_options_default <- function() {
stdout = "|",
stderr = "|",
poll_connection = TRUE,
repos = c(getOption("repos"), CRAN = "https://cloud.r-project.org"),
repos = default_repos(),
system_profile = FALSE,
user_profile = FALSE,
env = rcmd_safe_env(),
......
......@@ -616,7 +616,7 @@ r_session_options_default <- function() {
func = NULL,
args = NULL,
libpath = .libPaths(),
repos = c(getOption("repos"), CRAN = "https://cloud.r-project.org"),
repos = default_repos(),
stdout = NULL,
stderr = NULL,
error = getOption("callr.error", "error"),
......
......@@ -16,8 +16,7 @@
rcmd_bg <- function(cmd, cmdargs = character(), libpath = .libPaths(),
stdout = "|", stderr = "|",
poll_connection = TRUE,
repos = c(getOption("repos"),
c(CRAN = "https://cloud.r-project.org")),
repos = default_repos(),
system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), wd = ".",
supervise = FALSE) {
......
......@@ -39,8 +39,7 @@
#' }
rcmd <- function(cmd, cmdargs = character(), libpath = .libPaths(),
repos = c(getOption("repos"),
c(CRAN = "https://cloud.r-project.org")),
repos = default_repos(),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
echo = FALSE, show = FALSE, callback = NULL,
block_callback = NULL, spinner = show && interactive(),
......
......@@ -12,8 +12,7 @@
#' @export
rscript <- function(script, cmdargs = character(), libpath = .libPaths(),
repos = c(getOption("repos"),
c(CRAN = "https://cloud.r-project.org")),
repos = default_repos(),
stdout = NULL, stderr = NULL,
poll_connection = TRUE, echo = FALSE, show = TRUE,
callback = NULL, block_callback = NULL, spinner = FALSE,
......
......@@ -76,7 +76,7 @@ make_vanilla_script_expr <- function(expr_file, res, error,
},
error = function(e) { `__error__` },
interrupt = function(e) { `__error__` },
callr_message = function(e) { `__message__` }
callr_message = function(e) { try(`__message__`) }
),
## We need to `stop()` here again, otherwise the error message
......
#' Default value for the `repos` option in callr subprocesses
#'
#' callr sets the `repos` option in subprocesses, to make sure that
#' a CRAN mirror is set up. This is because the subprocess cannot bring
#' up the menu of CRAN mirrors for the user to choose from.
#'
#' @return Named character vector, the default value of the `repos`
#' option in callr subprocesses.
#'
#' @export
#' @examples
#' default_repos()
default_repos <- function() {
opt <- getOption("repos")
if (! "CRAN" %in% names(opt) || opt[["CRAN"]] == "@CRAN@") {
opt[["CRAN"]] <- "https://cloud.r-project.org"
}
opt
}
`%||%` <- function(l, r) if (is.null(l)) r else l
is.named <- function(x) {
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{default_repos}
\alias{default_repos}
\title{Default value for the \code{repos} option in callr subprocesses}
\usage{
default_repos()
}
\value{
Named character vector, the default value of the \code{repos}
option in callr subprocesses.
}
\description{
callr sets the \code{repos} option in subprocesses, to make sure that
a CRAN mirror is set up. This is because the subprocess cannot bring
up the menu of CRAN mirrors for the user to choose from.
}
\examples{
default_repos()
}
......@@ -6,21 +6,19 @@
\title{Evaluate an expression in another R session}
\usage{
r(func, args = list(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
error = getOption("callr.error", "error"), cmdargs = c("--slave",
"--no-save", "--no-restore"), show = FALSE, callback = NULL,
block_callback = NULL, spinner = show && interactive(),
system_profile = FALSE, user_profile = FALSE,
repos = default_repos(), stdout = NULL, stderr = NULL,
poll_connection = TRUE, error = getOption("callr.error", "error"),
cmdargs = c("--slave", "--no-save", "--no-restore"), show = FALSE,
callback = NULL, block_callback = NULL, spinner = show &&
interactive(), system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), timeout = Inf)
r_safe(func, args = list(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
error = getOption("callr.error", "error"), cmdargs = c("--slave",
"--no-save", "--no-restore"), show = FALSE, callback = NULL,
block_callback = NULL, spinner = show && interactive(),
system_profile = FALSE, user_profile = FALSE,
repos = default_repos(), stdout = NULL, stderr = NULL,
poll_connection = TRUE, error = getOption("callr.error", "error"),
cmdargs = c("--slave", "--no-save", "--no-restore"), show = FALSE,
callback = NULL, block_callback = NULL, spinner = show &&
interactive(), system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), timeout = Inf)
}
\arguments{
......
......@@ -5,11 +5,11 @@
\title{Evaluate an expression in another R session, in the background}
\usage{
r_bg(func, args = list(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = "|", stderr = "|", poll_connection = TRUE,
error = getOption("callr.error", "error"), cmdargs = c("--slave",
"--no-save", "--no-restore"), system_profile = FALSE,
user_profile = FALSE, env = rcmd_safe_env(), supervise = FALSE)
repos = default_repos(), stdout = "|", stderr = "|",
poll_connection = TRUE, error = getOption("callr.error", "error"),
cmdargs = c("--slave", "--no-save", "--no-restore"),
system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), supervise = FALSE)
}
\arguments{
\item{func}{Function object to call in the new R process.
......
......@@ -6,20 +6,18 @@
\title{Run an R CMD command}
\usage{
rcmd(cmd, cmdargs = character(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
echo = FALSE, show = FALSE, callback = NULL,
block_callback = NULL, spinner = show && interactive(),
system_profile = FALSE, user_profile = FALSE,
repos = default_repos(), stdout = NULL, stderr = NULL,
poll_connection = TRUE, echo = FALSE, show = FALSE,
callback = NULL, block_callback = NULL, spinner = show &&
interactive(), system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), timeout = Inf, wd = ".",
fail_on_status = FALSE)
rcmd_safe(cmd, cmdargs = character(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
echo = FALSE, show = FALSE, callback = NULL,
block_callback = NULL, spinner = show && interactive(),
system_profile = FALSE, user_profile = FALSE,
repos = default_repos(), stdout = NULL, stderr = NULL,
poll_connection = TRUE, echo = FALSE, show = FALSE,
callback = NULL, block_callback = NULL, spinner = show &&
interactive(), system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), timeout = Inf, wd = ".",
fail_on_status = FALSE)
}
......
......@@ -6,9 +6,9 @@
\usage{
rcmd_bg(cmd, cmdargs = character(), libpath = .libPaths(),
stdout = "|", stderr = "|", poll_connection = TRUE,
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), wd = ".", supervise = FALSE)
repos = default_repos(), system_profile = FALSE,
user_profile = FALSE, env = rcmd_safe_env(), wd = ".",
supervise = FALSE)
}
\arguments{
\item{cmd}{Command to run. See \code{R --help} from the command
......
......@@ -5,12 +5,12 @@
\title{Run an R script}
\usage{
rscript(script, cmdargs = character(), libpath = .libPaths(),
repos = c(getOption("repos"), c(CRAN = "https://cloud.r-project.org")),
stdout = NULL, stderr = NULL, poll_connection = TRUE,
echo = FALSE, show = TRUE, callback = NULL,
block_callback = NULL, spinner = FALSE, system_profile = FALSE,
user_profile = FALSE, env = rcmd_safe_env(), timeout = Inf,
wd = ".", fail_on_status = TRUE, color = TRUE)
repos = default_repos(), stdout = NULL, stderr = NULL,
poll_connection = TRUE, echo = FALSE, show = TRUE,
callback = NULL, block_callback = NULL, spinner = FALSE,
system_profile = FALSE, user_profile = FALSE,
env = rcmd_safe_env(), timeout = Inf, wd = ".",
fail_on_status = TRUE, color = TRUE)
}
\arguments{
\item{script}{Path of the script to run.}
......
context("messages")
test_that("messages in callr::r do not crash session", {
ret <- r(function() { cliapp::cli_text("fooobar"); 1 + 1 })
expect_identical(ret, 2)
gc()
})
test_that("messages in callr::r_bg do not crash session", {
rx <- r_bg(function() { cliapp::cli_text("fooobar"); 1 + 1 })
rx$wait(2000)
rx$kill()
expect_equal(rx$get_exit_status(), 0)
expect_equal(rx$get_result(), 2)
processx::processx_conn_close(rx$get_output_connection())
processx::processx_conn_close(rx$get_error_connection())
gc()
})
......@@ -20,3 +20,42 @@ test_that("is_complete_expression", {
withr::with_envvar(c(LANGUAGE = "de_DE"), do_tests())
}
})
test_that("default_repos", {
def <- "https://cloud.r-project.org"
withr::with_options(list(repos = NULL),
expect_equal(
default_repos(),
c(CRAN = def)))
withr::with_options(list(repos = character()),
expect_equal(
default_repos(),
c(CRAN = def)))
withr::with_options(list(repos = list()),
expect_equal(
default_repos(),
list(CRAN = def)))
withr::with_options(list(repos = c(foo = "bar")),
expect_equal(
default_repos(),
c(foo = "bar", CRAN = def)))
withr::with_options(list(repos = list(foo = "bar")),
expect_equal(
default_repos(),
list(foo = "bar", CRAN = def)))
withr::with_options(list(repos = c(foo = "bar", CRAN = "set")),
expect_equal(
default_repos(),
c(foo = "bar", CRAN = "set")))
withr::with_options(list(repos = c(foo = "bar", CRAN = "@CRAN@")),
expect_equal(
default_repos(),
c(foo = "bar", CRAN = def)))
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment