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

Minor progress bar infelicity #2220

Open
3 tasks done
hadley opened this issue Feb 8, 2023 · 6 comments
Open
3 tasks done

Minor progress bar infelicity #2220

hadley opened this issue Feb 8, 2023 · 6 comments
Labels
bug Bugs

Comments

@hadley
Copy link
Contributor

hadley commented Feb 8, 2023

I am loving the new progress bar! But I noticed a couple of small issues exemplified by this simple Rmd:

```{r alpha}
Sys.sleep(0.5)
```

```{r bravo}
Sys.sleep(0.5)
```

```{r charlie}
Sys.sleep(5)
```

After alpha and bravo have completed and charlie is still running, I see this:

Screenshot 2023-02-08 at 13 00 06

Two small problems:

  • Weirdly, the processing message appears part way in the middle of the progress bar
  • The progress bar shows 100% complete even though we're still working on chunk 3.

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@cderv cderv added the bug Bugs label Feb 8, 2023
@hadley
Copy link
Contributor Author

hadley commented Feb 8, 2023

Even more nitpicky, I noticed that if I run rmarkdown::render() there are two blank lines before the progress bar starts:

> rmarkdown::render("delay.Rmd")


processing file: delay.Rmd
  |........................                                                 |  33% (alpha)  

@hadley
Copy link
Contributor Author

hadley commented Feb 8, 2023

And maybe there's one extra empty line at the bottom too? (at least when run_pandoc = FALSE).

> invisible(rmarkdown::render("delay.Rmd", run_pandoc = FALSE))

processing file: delay.Rmd
                                                                                                                 
output file: delay.knit.md

> 

@hadley
Copy link
Contributor Author

hadley commented Feb 9, 2023

Hmmm, the first problem (where "processing..." is interleaved in the output") might actually be an RStudio problem

@hadley
Copy link
Contributor Author

hadley commented Feb 9, 2023

It is an RStudio bug: rstudio/rstudio#8160. knitr could work around it by outputing the "Process file" message to stdout() instead of stderr(). We have some techniques to do this in rlang/cli, but you could also just switch the message() to cat().

@kevinushey pointed me to this article on why interleaving streams is generally hard: https://unix.stackexchange.com/questions/476080/what-prevents-stdout-stderr-from-interleaving/476089#476089. You might also argue that maybe the problem is that the progress bar is using stdout() since everything that appears in this display will be using stderr()

@hadley
Copy link
Contributor Author

hadley commented Feb 13, 2023

Not 100% sure this is the same problem, but note that in this connnect log the progress bar shows up after the error.

Screenshot 2023-02-13 at 16 03 18

@kevinushey
Copy link

This is almost surely an RStudio issue -- not sure if there's a way to replicate the same flow in a "regular" R instance outside of RStudio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs
Projects
None yet
Development

No branches or pull requests

3 participants