Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress bar should use stderr() inside knitr documents #583

Open
hadley opened this issue Feb 16, 2023 · 4 comments
Open

Progress bar should use stderr() inside knitr documents #583

hadley opened this issue Feb 16, 2023 · 4 comments
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@hadley
Copy link
Member

hadley commented Feb 16, 2023

e.g. create an .Rmd that contains this and knitr it from the IDE:

```{r}
cli::cli_progress_bar(total = 20)
for (i in 1:20) {
  cli::cli_progress_update()
  Sys.sleep(0.2)
}
```

The progress bar should appear in the Render pane (i.e. stderr()) rather than appearing in the output. (And I'd expect it to only be updated every 3 seconds).

@hadley
Copy link
Member Author

hadley commented Feb 16, 2023

@gaborcsardi
Copy link
Member

Somewhat related to this is that if the background thread if off, like in webR, then currently there are no (timed) progress updates. If we fix the update interval here, then we might as well fix that.

@sebastian-gerdes
Copy link

sebastian-gerdes commented Sep 17, 2023

I can only second this issue.

It would be really nice to be able to conveniently use progress bars in via purrr.

The knitrProgressBar package works, but of course a "direct" solution would be nicer.

Currently, I am using this work-around:

pb <- knitrProgressBar::progress_estimated(100)
purrr::walk(1:100, \(i) {
  Sys.sleep(0.03)
  knitrProgressBar::update_progress(pb)      
})

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Oct 31, 2023
@olivroy
Copy link
Contributor

olivroy commented Dec 5, 2023

Is there a workaround for this? like setting an option. I feel like it should hide in non-interactive output.

@gaborcsardi gaborcsardi added this to the cli 3.7.0 milestone Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants