Reputation: 1205
I am using VS Code to do remote Python development on an Ubuntu Server via ssh. VS Code handles the ssh connection. I launch processes from the IDE. If there is a disconnect even very briefly, the processes are killed.
Is there a way to stop that from happening? I expected that there would be a setting in VS Code because there is a VS Code server that gets installed on the remote machine but have found nothing.
Note: I tried the recommended procedure by Moreno here where he uses 'tmux' however it was not successful in Linux unless you use the mod that Faria presents in the comments section
Update: It is possible to 'break' the solution proposed by Moreno. After a lengthy disconnect VS Code started returning 'The terminal process /home/.../code-shell failed to launch (exit code: 1)'. Following the recommended trouble-shooting did not correct the problem. Ended up restarting VS Code which is a suboptimal solution.
Upvotes: 11
Views: 15914
Reputation: 1205
As noted I am working VS Code in a remote Ubuntu environment that I ssh in to. If you are doing so follow the steps that are outlined by Moreno (see link in question) BUT because I am working in a Linux environment I had to adjust some items in the script. The adjustments are:
make sure you set file permissions on 'code-shell' so that execution
is possible. So in my case at the CLI I did chmod a+x code-shell
allowed execution by anyone but you can make it
whatever you're comfortable with;
make the shebang line in your script use /usr/bin/env bash
which will choose the first permissible shell your environment will
allow. Using /bin/bash
did not work for me.
a slight change to the naming portion of the script. I made it 'vscode' followed by the first 3 characters of md5 sum. That makes new terminals distinguishable.
The final script which works for me is:
So the whole process is: set up for ssh remote in VS Code -> adjust VS Code settings in workspace to run modified terminal (code-shell) -> create code-shell script with required permissions. If you get a disconnect running processes will continue uninterrupted.
Upvotes: 5