Skip to content

Commit

Permalink
quarto version query now does not leave detritus
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Feb 5, 2025
1 parent 5d42243 commit 8014161
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
`sessioninfo.include_hostname` global option is set to `TRUE`
(@certara-jcraig, #99).

* sessioninfo now does not leave behind detritus in the temporary
directory.

# sessioninfo 1.2.2

* This version does not add an emoji hash to the output.
Expand Down
1 change: 1 addition & 0 deletions R/mocks.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ getNamespaceVersion <- NULL
loadedNamespaces <- NULL
search <- NULL
system <- NULL
system2 <- NULL
8 changes: 6 additions & 2 deletions R/platform-info.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ get_quarto_version <- function() {
if (path == "") {
"NA"
} else {
ver <- system("quarto -V", intern = TRUE)[1]
tmp <- tempfile()
on.exit(unlink(tmp, recursive = TRUE), add = TRUE)
dir.create(tmp, recursive = TRUE, showWarnings = FALSE)
tmp <- normalizePath(tmp, winslash = "/")
ver <- system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", tmp))[1]
paste0(ver, " @ ", path)
}
}
}

#' @export

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-platform-info.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ test_that("get_quarto_version", {
expect_snapshot(get_quarto_version())

local_mocked_bindings(Sys.which = function(...) "/path/to/quarto")
local_mocked_bindings(system = function(...) "1.3.450")
local_mocked_bindings(system2 = function(...) "1.3.450")
expect_snapshot(get_quarto_version())
})

0 comments on commit 8014161

Please sign in to comment.