This is for expert use, if you want to run multiple recordings in the same process.
asciicast_start_process(
startup = NULL,
timeout = 10,
record_env = NULL,
interactive = TRUE,
locales = get_locales(),
options = NULL,
show_output = FALSE
)
Quoted language object to run in the subprocess before starting the recording.
Idle timeout, in seconds If the R subprocess running the recording does not answer within this limit, it is killed and the recording stops.
Environment variables to set for the R subprocess.
Whether to run R in interactive mode. Note that in interactive mode R might ask for terminal input.
Locales to set in the asciicast subprocess. Defaults
to the current locales in the main R process. Specify a named character
vector here to override some of the defaults. See also get_locales()
.
Options to set in the subprocess, a named list.
They are deparsed to code, and then the code setting them is
executed in the subprocess. See asciicast_options()
for the
defaults. Supply a named list here to override the defaults or set
additionsl ones. Passing large and/or complicated options here might
not work, or might be slow.
Whether to show the output of the subprocess in real time.
The R process, a processx::process object.
Other asciicast functions:
asciicast-package
,
read_cast()
,
record()
,
write_json()
# Use the same R process to record multiple casts
process <- asciicast_start_process()
script1 <- "a <- runif(10)\n"
script2 <- "a\n"
cast1 <- record(textConnection(script1), process = process)
cast2 <- record(textConnection(script2), process = process)
cast1
#> <asciicast>
#> <config>
#> "version": 2,
#> "command": "R -q",
#> "timestamp": 1748546801,
#> "env": {
#> "TERM": "xterm-256color",
#> "SHELL": "/bin/zsh"
#> },
#> "height": 24,
#> "rows": 24,
#> "width": 80,
#> "cols": 80
#>
#> <frames>
#> # A tibble: 24 × 3
#> time type data
#> <dbl> <chr> <chr>
#> 1 0 rlib "type: prompt"
#> 2 0 o "> "
#> 3 0 i "a <- runif(10)\r\n"
#> 4 0 rlib "type: input"
#> 5 0.0290 o "a"
#> 6 0.0958 o " "
#> 7 0.151 o "<"
#> 8 0.184 o "-"
#> 9 0.209 o " "
#> 10 0.257 o "r"
#> # ℹ 14 more rows
cast2
#> <asciicast>
#> <config>
#> "version": 2,
#> "command": "R -q",
#> "timestamp": 1748546801,
#> "env": {
#> "TERM": "xterm-256color",
#> "SHELL": "/bin/zsh"
#> },
#> "height": 24,
#> "rows": 24,
#> "width": 80,
#> "cols": 80
#>
#> <frames>
#> # A tibble: 39 × 3
#> time type data
#> <dbl> <chr> <chr>
#> 1 0 rlib "type: prompt"
#> 2 0 o "> "
#> 3 0 i "a\r\n"
#> 4 0 rlib "type: input"
#> 5 0.0451 o "a"
#> 6 0.0451 o "\r\n"
#> 7 0.0451 rlib "busy: 1"
#> 8 0.0452 rlib "type: stdout"
#> 9 0.0452 o " [1]"
#> 10 0.0452 rlib "type: stdout"
#> # ℹ 29 more rows