Use XDG_RUNTIME_DIR to store control master sockets

On Linux this has the advantage that the dir is auto cleaned on reboot
This commit is contained in:
Kovid Goyal
2022-03-10 12:50:59 +05:30
parent 384c56f834
commit 31d9db7e74
4 changed files with 29 additions and 5 deletions

View File

@@ -23,7 +23,10 @@ from typing import (
Tuple, Union
)
from kitty.constants import cache_dir, shell_integration_dir, terminfo_dir
from kitty.constants import (
cache_dir, runtime_dir, shell_integration_dir, ssh_control_master_template,
terminfo_dir
)
from kitty.fast_data_types import get_options
from kitty.shm import SharedMemory
from kitty.utils import SSHConnectionData
@@ -442,7 +445,7 @@ def get_remote_command(
def connection_sharing_args(opts: SSHOptions, kitty_pid: int) -> List[str]:
cp = os.path.join(cache_dir(), 'ssh', f'{kitty_pid}-master-%C')
cp = os.path.join(runtime_dir(), ssh_control_master_template.format(kitty_pid=kitty_pid, ssh_placeholder='%C'))
ans: List[str] = [
'-o', 'ControlMaster=auto',
'-o', f'ControlPath={cp}',