From 6974279598695feed4ef36d71f112179b34f9aed Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Mon, 23 Sep 2024 14:40:53 -0400 Subject: [PATCH] Better handle silent errors closes:#1674 return from `system2()` can be a length!=1 character --- R/config.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/config.R b/R/config.R index bdb0c6e0..23c98b22 100644 --- a/R/config.R +++ b/R/config.R @@ -375,9 +375,11 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) { # https://github.com/rstudio/reticulate/issues/1325 get_platform <- function(python) { tryCatch({ - system2(python, - args = c("-c", shQuote("import sys; print(sys.platform)")), - stdout = TRUE, stderr = FALSE) + plat <- system2(python, + args = c("-c", shQuote("import sys; print(sys.platform)")), + stdout = TRUE, stderr = FALSE + ) + if (rlang::is_string(plat)) plat else "" }, warning = function(w) "", error = function(e) "") } python_sys_platforms <- vapply(python_versions, get_platform, "")