-
Notifications
You must be signed in to change notification settings - Fork 39
Closed as not planned
Description
Issue
From r-lib/cli#467, cli
colors printed from inside callr
are not preserved when forwarded to the main process.
Example:
out <- callr::r(
\() {
cli::ansi_palette_show()
},
show = TRUE
)
Causes
cli
usesmessage()
, which goes to standard error.- The
callr
child process does not necessarily choose the same number of ANSI colors as the parent process.
Evidence of (2):
cli::num_ansi_colors()
#> [1] 256
callr::r(\() cli::num_ansi_colors())
#> [1] 1
Manual workarounds
- Redirect stderr to stdout.
- Inside the
callr
child process, set thecli.num_colors
option to the correct number of colors.
Example:
out <- callr::r(
\() {
options(cli.num_colors = 256)
cli::ansi_palette_show()
},
show = TRUE,
stderr = "2>&1"
)
Request
Is there a way to make cli
colors "just work" (TM) using the defaults of both packages? I'm not sure what would need to change, but I do believe that aligning the child process colors with those of the parent would be the most intuitive and convenient default behavior.
Metadata
Metadata
Assignees
Labels
No labels