Learn R Programming

rstudioapi (version 0.14)

terminalBusy: Is Terminal Busy

Description

Are terminals reporting that they are busy?

Usage

terminalBusy(id)

Value

a boolean

Arguments

id

The terminal id. The id is obtained from terminalList(), terminalVisible(), terminalCreate(), or terminalExecute().

Details

This feature is only supported on RStudio Desktop for Mac and Linux, and RStudio Server. It always returns FALSE on RStudio Desktop for Microsoft Windows.

Examples

Run this code

if (FALSE) {
# 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")
}

Run the code above in your browser using DataLab