cli icon indicating copy to clipboard operation
cli copied to clipboard

cli R package progress bars not showing if multiple progress bars created in quick succession

Open gacolitti opened this issue 2 years ago • 2 comments

If I create multiple {cli} progress bars in quick succession, only the first progress bar is shown. However, if I add a short timer with Sys.sleep(0.2), all progress bars are shown:

options(cli.progress_show_after = 0)

fun <- function(step) {
  cli::cli_progress_bar(
    clear = FALSE
  )
  cli::cli_progress_update(inc = 0)
  cli::cli_progress_done()
}

fun_sleep <- function(step) {
  cli::cli_progress_bar(
    clear = FALSE
  )
  cli::cli_progress_update(inc = 0)
  cli::cli_progress_done()
  Sys.sleep(0.2)
}

purrr::walk(1:3, function(x) fun(x))

purrr::walk(1:3, function(x) fun_sleep(x))

How do I show all progress bars without needing to use Sys.sleep(0.2)?

Cross posted on stackoverflow: https://stackoverflow.com/questions/76204800/cli-r-package-progress-bars-not-showing

gacolitti avatar May 09 '23 16:05 gacolitti

Seems like a bug to me.

gaborcsardi avatar May 09 '23 17:05 gaborcsardi

I'm finding this to be the case for me as well. Worked perfectly on R v4.2.1 on my M1 mac, but after updating to 4.3 on my M1 it won't display anything.

rafev avatar May 16 '23 14:05 rafev