Problem with shell in RStudio IDE 1.1.456 (Windows)



I run into a persistent problem with the shell (Tools >> Shell...). If I open the shell everything works fine. However, if I close it and then open it again. Things stop working. I was able to pin this down to a problem with the HOME environment variable

$ echo $HOME

but after closing the session in opening it again I see

$ echo $HOME

so clearly somehting is wrong with startup/environment. I have no idea how to debug it further.

Please help as it is very annoying -- I need to restart RStudio session if I accidentally close and re-open the shell window.