lbartnik / subprocess

Other
49 stars 10 forks source link

Add terminal emulation #28

Closed johndharrison closed 7 years ago

johndharrison commented 7 years ago

For a process like R that exposes a terminal we could have an emulated terminal. I added a basic terminal with code modified from https://github.com/jeroenooms/V8/blob/master/R/V8.R#L173 .

is_windows <- function () (tolower(.Platform$OS.type) == "windows")

R_binary <- function () {
  R_exe <- ifelse (is_windows(), "R.exe", "R")
  return(file.path(R.home("bin"), R_exe))
}

handle <- spawn_process(R_binary(), c('--no-save'))
Sys.sleep(5)
if(interactive()) process_terminal(handle)
codecov-io commented 7 years ago

Current coverage is 67.15% (diff: 100%)

Merging #28 into master will not change coverage

@@             master        #28   diff @@
==========================================
  Files            11         11          
  Lines           548        548          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            368        368          
  Misses          180        180          
  Partials          0          0          

Powered by Codecov. Last update c32be2f...50cda45

lbartnik commented 7 years ago

Hey, this is quite interesting but I'd rather turn it into a new vignette not a regular function in this package. What do you think?

johndharrison commented 7 years ago

Maybe add it as a demo. You can call it with

demo("spterminal", package = "subprocess")
lbartnik commented 7 years ago

I'll be happy to add it as a vignette. Closing for now.