Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
if (requireNamespace(c("callr", "git2r", "gert", "cli"), quietly = TRUE)) {
has_git = git2r::in_repository()
if (has_git && Sys.getenv("RSTUDIO") == 1) {
cli::cli_text("Running
{.code gert::git_pull(verbose = FALSE, prune = TRUE, rebase = TRUE)}
in the background.")
callr::r_bg(function() {
gert::git_pull(verbose = FALSE, prune = TRUE, rebase = TRUE)
},
stdout = out <- tempfile(), stderr = err <- tempfile())$wait()
cli::cli_text("stdout: '{readLines(out)}'")
cli::cli_text("stderr: '{readLines(err)}'")
# cat(readLines(out), sep = "\n")
# cat(readLines(err), sep = "\n")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment