diff --git a/R/system-requirements.R b/R/system-requirements.R index dfa10cb84..721c35bcb 100644 --- a/R/system-requirements.R +++ b/R/system-requirements.R @@ -116,11 +116,12 @@ system_requirements_internal <- function(os, os_release, root, package, execute, callback <- function(x, ...) invisible() } + if (sudo && length(commands) > 0) { + commands <- paste("sudo", commands) + } + if (execute) { for (cmd in commands) { - if (sudo) { - cmd <- paste("sudo", cmd) - } cli::cli_alert_info("Executing {.code {cmd}}") processx::run("sh", c("-c", cmd), stdout_callback = callback, stderr_to_stdout = TRUE)