# NOT RUN {
# 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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace