From 0bcc462989291cb6f04960e3e1a6ebbf02ad4e78 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 10 Dec 2024 07:29:56 -0800 Subject: [PATCH] Test existence of EDITOR before attempting to use it --- R/edit.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/edit.R b/R/edit.R index e85412c79..f236ec225 100644 --- a/R/edit.R +++ b/R/edit.R @@ -31,7 +31,7 @@ edit_file <- function(path, open = rlang::is_interactive()) { ui_bullets(c("_" = "Modify {.path {pth(path)}}.")) if (rstudio_available() && rstudioapi::hasFun("navigateToFile")) { rstudioapi::navigateToFile(path) - } else { + } else if (nzchar(Sys.which(Sys.getenv("EDITOR")))) { utils::file.edit(path) } invisible(path)