SAMPLE FROM RSTUDIO
Start a command with results displayed in a terminal buffer
termId <- rstudioapi::terminalExecute("ping rstudio.com")
If viewing the result in the terminal buffer is sufficient, then no need to do anything else. The command will continue running and displaying its results without blocking the R session.
To obtain the results programmatically, wait for it to finish.
while (is.null(rstudioapi::terminalExitCode(termId))) {
Sys.sleep(0.1)
}
result <- rstudioapi::terminalBuffer(termId)
Delete the buffer and close the session in the IDE
rstudioapi::terminalKill(termId)
My goal is to 'PING' multiple website for examples:
c = c("google.com","bing.com","rstudio.com")
I want to put this in the sleep loop so the code that comes after ping does not get run yet until the ping process finishes. I want to print that every ping process is complete once it is and then a final message when all the pings are done and then last to clear and close all terminal windows.