-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure workspace is cleared #1318
Conversation
Workspace viewer will no longer show "ghost" data from previous sessions
Thanks for working on this! Ideally, if the R session exits, the workspace viewer should go empty, and the status bar item should be reset to "R: (not attached)". In my case, I mostly use self-managed R terminals (e.g. starting radian in tmux windows manually). Not sure if there is a way to handle this so that whenever the attached R session exits, the workspace viewer and status bar item will be reset. |
Hmm, that's a good point, thank you. I wonder if using a finalizer on the R side of things could be viable... will have a play around with it |
I tried A simple way is to add the following in reg.finalizer(globalenv(), function(e) .vsc$request("detach"), onexit = TRUE) and handle |
I'm not sure there's a way to handle unsafe exits -- couldn't find any way to handle them. Even temp folders don't seem to be cleared when R crashes or is killed I think having a finalizer would still be worth it in the long run? I'd like a solution for unsafe exits though |
Not sure if there is a way to get notified by the exit signal of an external process in nodejs since we know the pid of the attached R session. |
Good idea! Looks like it is possible to check if an arbitrary process is alive via Not exactly a watcher though |
- safe exit of R session causes a detach - detach clears workspace + status item
The |
Hi @renkun-ken, would you like to try the current implementation to see if it works with your tmux setup? |
I tried with the following use cases and all work properly!
Just push a minor fix to address the linter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!
What problem did you solve?
Workspaces will be cleared if:
(If you have)Screenshot
After closing the terminal: