diff --git a/kitty/constants.py b/kitty/constants.py index bafe10c25..68ac386ca 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -151,7 +151,9 @@ def runtime_dir() -> str: if not os.path.isdir(candidate) or not os.access(candidate, os.X_OK | os.W_OK | os.R_OK): candidate = os.path.join(cache_dir(), 'run') os.makedirs(candidate, exist_ok=True) - os.chmod(candidate, 0o700) + import stat + if stat.S_IMODE(os.stat(candidate).st_mode) != 0o700: + os.chmod(candidate, 0o700) return candidate diff --git a/kitty_tests/ssh.py b/kitty_tests/ssh.py index 5931a5a29..814cc9d9f 100644 --- a/kitty_tests/ssh.py +++ b/kitty_tests/ssh.py @@ -14,7 +14,7 @@ from kittens.ssh.main import ( ) from kittens.ssh.options.utils import DELETE_ENV_VAR from kittens.transfer.utils import set_paths -from kitty.constants import is_macos +from kitty.constants import is_macos, runtime_dir from kitty.fast_data_types import CURSOR_BEAM from kitty.options.utils import shell_integration from kitty.utils import SSHConnectionData @@ -56,6 +56,7 @@ print(' '.join(map(str, buf)))'''), lines=13, cols=77) t('ssh un@ip -iident -p34', host='un@ip', port=34, identity_file='ident') t('ssh -p 33 main', port=33) t('ssh --kitten=one -p 12 --kitten two -ix main', identity_file='x', port=12, extra_args=(('--kitten', 'one'), ('--kitten', 'two'))) + self.assertTrue(runtime_dir()) def test_ssh_config_parsing(self): def parse(conf):