Skip to content

Commit

Permalink
If error in gh code , be sure to remove the created bundled
Browse files Browse the repository at this point in the history
related to r-lib/gh#178
  • Loading branch information
cderv committed Feb 26, 2024
1 parent 840a899 commit df6a573
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/pandoc-install.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,15 @@ pandoc_install_nightly <- function(n_last = 1L) {
bundle_name <- fs::path_ext_set(head_sha, "zip")
rlang::inform(c(i = "Installing last available nightly..."))
tmp_file <- with_download_cache("nightly", bundle_name, {
gh::gh(artifact_url, .destfile = bundle_name)
tryCatch({
gh::gh(artifact_url, .destfile = bundle_name)
},
error = function(e) {
if (fs::file_exists(bundle_name)) {
fs::file_delete(bundle_name)
}
rlang::abort(parent = e, class = "pandoc_pkg_download_cache_error")
})
})

utils::unzip(tmp_file, exdir = install_dir, junkpaths = TRUE)
Expand Down

0 comments on commit df6a573

Please sign in to comment.