I'm really enjoying cli progress bars, but I'm struggling with an edge case. For ropensci/targets#1442, I need to run the progress bar behind a non-interactive callr process. Unfortunately, the non-interactivity seems to make the progress bar slightly less responsive, and it seems to spill over into multiple lines. This is the desired behavior when writing to a fixed log file, but it's counterintuitive when the parent session is interactive. Are there any workarounds etc.?
out <- callr::r(
\() {
library(cli)
clean <- function() {
options(cli.num_colors = 256)
cli_progress_bar("Cleaning data", total = 100)
for (i in 1:100) {
Sys.sleep(5/100)
cli_progress_update()
}
cli_progress_done()
}
clean()
},
show = TRUE,
stderr = "2>&1"
)
#> Cleaning data ■■■■■■■ 19% | ETA: 4s
#> Cleaning data ■■■■■■■■■■■■■■■■■ 55% | ETA: 2s
#> Cleaning data ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | #> ETA: 0s
I'm really enjoying
cliprogress bars, but I'm struggling with an edge case. For ropensci/targets#1442, I need to run the progress bar behind a non-interactivecallrprocess. Unfortunately, the non-interactivity seems to make the progress bar slightly less responsive, and it seems to spill over into multiple lines. This is the desired behavior when writing to a fixed log file, but it's counterintuitive when the parent session is interactive. Are there any workarounds etc.?