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

Colored text for jobRunScript output #9411

Closed
mike-lawrence opened this issue May 26, 2021 · 5 comments
Closed

Colored text for jobRunScript output #9411

mike-lawrence opened this issue May 26, 2021 · 5 comments

Comments

@mike-lawrence
Copy link

@mike-lawrence mike-lawrence commented May 26, 2021

I have a script that uses the crayon package to color text, and when sourced in the console I get the expected coloring of cat() outputs, but when using rstudioapi::jobRunScript() the job's output isn't colored. For example:

tmp= tempfile()
write('cat(crayon::red("hello"))',tmp)
rstudioapi::jobRunScript(tmp)
@ronblum
Copy link
Contributor

@ronblum ronblum commented May 27, 2021

@mike-lawrence Thank you for raising this! We'll review it as part of our ongoing RStudio development.

@jmcphers
Copy link
Member

@jmcphers jmcphers commented Jun 8, 2021

Also just mentioned on https://community.rstudio.com/t/crayon-package-output-not-working-in-rstudio-jobs-tab/106790. I have a recollection of this working in the past; I wonder if a change to the package, or RStudio, broke it?

@jmcphers
Copy link
Member

@jmcphers jmcphers commented Jun 8, 2021

I think this broke in the crayon package in r-lib/crayon@07635d7.

@mike-lawrence
Copy link
Author

@mike-lawrence mike-lawrence commented Jun 9, 2021

Ah, yes, when I belatedly just now tried simply using control codes to do the colors manually, they come out fine, so this is a crayon issue rather than an rstudio issue. Thanks for helping work this out!

@mike-lawrence
Copy link
Author

@mike-lawrence mike-lawrence commented Jun 9, 2021

Note, made an issue for this on the crayon repo, including code demonstrating it's selective to jobs launched with rstudioapi::jobRunScript() (though still a crayon issue since explicit color codes work fine).

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

No branches or pull requests

3 participants