Ensure terminal is running and optionally bring to front in RStudio.
Arguments
- id
The terminal id. The
idis obtained fromterminalList(),terminalVisible(),terminalCreate(), orterminalExecute(). If NULL, the terminal tab will be selected but no specific terminal will be chosen.- show
If TRUE, bring the terminal to front in RStudio.
Examples
if (FALSE) { # \dontrun{
# create a hidden terminal and run a lengthy command
termId = rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(termId, "sleep 5\n")
# wait until a busy terminal is finished
while (rstudioapi::terminalBusy(termId)) {
Sys.sleep(0.1)
}
print("Terminal available")#'
rstudioapi::terminalActivate(termId)
} # }