-
Notifications
You must be signed in to change notification settings - Fork 272
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
Persistent progress_bar after interrupting map
loop in the middle
#1024
Comments
|
I can't reproduce this so we'll need to get some more info. Can you please run the following code? packageVersion("cli")
sessioninfo::platform_info() |
packageVersion("cli")
#> [1] '3.4.1'
sessioninfo::platform_info()
#> setting value
#> version R version 4.1.1 (2021-08-10)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate Portuguese_Brazil.1252
#> ctype Portuguese_Brazil.1252
#> tz America/Sao_Paulo
#> date 2022-12-21
#> pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) Created on 2022-12-21 with reprex v2.0.2 |
I'd start by restarting R and installing the latest cli (3.5). |
I can reproduce this too actually. With CRAN cli. As @brunomioto said, if you run the first call of |
Another way to reproduce is to cause a It is possible we need to use library(purrr)
example_fun <- function(query){
res <- purrr::map(query, .f = function(x) {
if (x == "b") {
stop("oh no")
}
}, .progress = list(format = "Query {cli::pb_current+1}/{cli::pb_total} | {cli::pb_bar} {cli::pb_percent} [{cli::pb_elapsed}]",
show_after = 0,
clear = TRUE)
)%>%
purrr::list_rbind()
return(res)
}
#First example - Pressed Esc in 33%
example_fun(c("a","b","c"))
#Second example - Run normally
example_fun(c("a","c")) |
cc @gaborcsardi |
Yeah, there are two ways to fix this afaict. First is by adding cleancall support to purrr, i.e. embedding Second is to implement an exit handler in purrr itself, without cleancall. |
I'm using it in a personal function, but will try to reproduce it asap.
I run the function, progress bars appears and everything works fine (it even disappears as expected).
But if I interrupt this map loop with
Esc
, the progress bar keeping appearing after every code I ranThe text was updated successfully, but these errors were encountered: