Skip to content

Progress bar responsiveness behind callr processes #756

@wlandau

Description

@wlandau

Related to #755. It seems that progress bars update less frequently when they run behind callr processes.

out <- callr::r(
  \() {
    library(cli)
    clean <- function() {
      options(cli.num_colors = 256, cli.dynamic = TRUE)
      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"
)

Image

It would be nice if they updated with the same frequency and timing as in the local process.

clean <- function() {
  options(cli.num_colors = 256, cli.dynamic = TRUE)
  cli_progress_bar("Cleaning data", total = 100)
  for (i in 1:100) {
    Sys.sleep(5/100)
    cli_progress_update()
  }
  cli_progress_done()
}
clean()

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions