asciicast_start_process: Start an asciicast background process

View source: R/embed.R

asciicast_start_processR Documentation

Start an asciicast background process

Description

This is for expert use, if you want to run multiple recordings in the same process.

Usage

asciicast_start_process(
  startup = NULL,
  timeout = 10,
  record_env = NULL,
  interactive = TRUE,
  locales = get_locales(),
  options = NULL,
  show_output = FALSE
)

Arguments

startup

Quoted language object to run in the subprocess before starting the recording.

timeout

Idle timeout, in seconds If the R subprocess running the recording does not answer within this limit, it is killed and the recording stops.

record_env

Environment variables to set for the R subprocess.

interactive

Whether to run R in interactive mode. Note that in interactive mode R might ask for terminal input.

locales

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

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.

show_output

Whether to show the output of the subprocess in real time.

Value

The R process, a processx::process object.

See Also

Other asciicast functions: asciicast-package, read_cast(), record(), write_json()

Examples


# 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
cast2


asciicast documentation built on May 29, 2024, 6:24 a.m.