Open wurli opened 4 months ago
Here's the workaround function I've been using for anyone running into the same problem:
capture_all_output <- function(expr) {
con <- textConnection("out", open = "w", local = TRUE)
sink(con, append = TRUE, type = "output")
sink(con, append = TRUE, type = "message")
force(expr)
sink(type = "output")
sink(type = "message")
close(con)
get("out")
}
That's intentional. It only captures the semantic CLI elements: https://cli.r-lib.org/reference/index.html#semantic-cli-elements
Aha, thanks for explaining. Is this because cli_()
functions write to stderr
instead of stdout
? I wonder if it would be helpful to add something to the documentation about the different streams cli uses and why...
Here's a reprex:
Created on 2024-07-09 with reprex v2.1.0