-
Notifications
You must be signed in to change notification settings - Fork 71
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
Internal error with ansi_strwrap
when string contains \r\n\r
in cli_abort()
message
#667
Labels
bug
an unexpected problem or unintended behavior
tidy-dev-day 🤓
Tidyverse Developer Day rstd.io/tidy-dev-day
Comments
Smaller reprex:
|
gaborcsardi
added
the
tidy-dev-day 🤓
Tidyverse Developer Day rstd.io/tidy-dev-day
label
Jul 17, 2024
Seems like cli::ansi_strwrap(cli::col_red("foobar \r |"))
# Error in `cli::ansi_strwrap(cli::col_red("foobar \r |"))`:
# ! Internal error in `cli::ansi_strwrap()`
# Type .Last.error to see the more details.
ansi_strwrap("foobar \r |")
# <cli_ansi_string>
# [1] foobar |
ansi_strwrap(paste0(cli::col_red("foobar"), "\r |"))
# <cli_ansi_string>
# |] foobar |
Adding Lines 614 to 617 in 2ddcc1a
does avoid the error we're seeing but there is then a secondary issue arrives where it is now possible for the ansi control codes to be out of order resulting in broken output. cli::ansi_strwrap(cli::col_red("foobar \r |"))
# <cli_ansi_string>
# |] foobar
cli::ansi_strwrap(cli::col_red("foobar \r |")) |> str()
# 'cli_ansi_string' chr "\033[31mfoobar \r |\033[39m" |
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
tidy-dev-day 🤓
Tidyverse Developer Day rstd.io/tidy-dev-day
Running in RStudio R console this leads to an internal error
The message string is part of the content created by knitr progress bar which uses
txtProgressBar
.I encountered this in the context of quarto R package, where
quarto render
is run withprocessx::run()
and I wanted to usecli_abort()
in the error catchhttps://github.com/quarto-dev/quarto-r/blob/8a0bcb3a7cf35ce4eb2b412d6d09542cc7b2b35d/R/quarto.R#L41-L48
The full
stderr
I get in the code above is the following, which leads to same errorThe text was updated successfully, but these errors were encountered: