randy3k / radian

A 21 century R console
MIT License
1.98k stars 73 forks source link

cannot quit radian #185

Open isezen opened 4 years ago

isezen commented 4 years ago

Hello, I can not quit radian because of the error below with Python 3.8 + radian 0.5.4.

r$> quit()
Error in .External2(C_savehistory, file) : no history available to save

r$> quit("no")
Error in .External2(C_savehistory, file) : no history available to save

r$> quit("yes")
Error in .External2(C_savehistory, file) : no history available to save
randy3k commented 4 years ago

I cannot reproduce it but ctrl+d should at least work.

randy3k commented 4 years ago

by the way, what os are you on?

isezen commented 4 years ago

I'm sorry for the inconvenience. Whole the problem was savehistory command in my custom Rprofile.site file. It had the following code and command did not let the session to quit. OS is macOS.

.Last <- function() {
  if(interactive()) {
    hist_file <- Sys.getenv("R_HISTFILE")
    if (hist_file == "") hist_file <- "~/.Rhistory"
    savehistory(hist_file)
  }
}

System info:

platform       x86_64-apple-darwin19.4.0   
arch           x86_64                      
os             darwin19.4.0                
system         x86_64, darwin19.4.0        
status                                     
major          4                           
minor          0.0                         
year           2020                        
month          04                          
day            24                          
svn rev        78286                       
language       R                           
version.string R version 4.0.0 (2020-04-24)
nickname       Arbor Day 

EDIT:

By the help of issue: #98

.Last <- function() {
  if(interactive()) {
    hist_file <- Sys.getenv("R_HISTFILE")
    if (hist_file == "") hist_file <- "~/.Rhistory"
    if (!nzchar(Sys.getenv("RADIAN_VERSION"))) savehistory(hist_file)
  }
}