On macOS always use the cache dir a runtime dir
Also make the constant parts of the socket name shorter as there is a 104 bytes limit on it in macOS SSH.
This commit is contained in:
parent
719339e116
commit
76a536ece0
@ -141,10 +141,12 @@ def cache_dir() -> str:
|
|||||||
def runtime_dir() -> str:
|
def runtime_dir() -> str:
|
||||||
if 'KITTY_RUNTIME_DIRECTORY' in os.environ:
|
if 'KITTY_RUNTIME_DIRECTORY' in os.environ:
|
||||||
candidate = os.path.abspath(os.environ['KITTY_RUNTIME_DIRECTORY'])
|
candidate = os.path.abspath(os.environ['KITTY_RUNTIME_DIRECTORY'])
|
||||||
|
elif is_macos:
|
||||||
|
candidate = os.path.join(cache_dir(), 'run')
|
||||||
elif 'XDG_RUNTIME_DIR' in os.environ:
|
elif 'XDG_RUNTIME_DIR' in os.environ:
|
||||||
candidate = os.path.abspath(os.environ['XDG_RUNTIME_DIR'])
|
candidate = os.path.abspath(os.environ['XDG_RUNTIME_DIR'])
|
||||||
else:
|
else:
|
||||||
candidate = os.path.join(cache_dir(), 'run')
|
candidate = os.environ.get('XDG_RUNTIME_DIR', os.path.join(cache_dir(), 'run'))
|
||||||
os.makedirs(candidate, exist_ok=True)
|
os.makedirs(candidate, exist_ok=True)
|
||||||
os.chmod(candidate, 0o700)
|
os.chmod(candidate, 0o700)
|
||||||
return candidate
|
return candidate
|
||||||
@ -167,7 +169,9 @@ except KeyError:
|
|||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
print('Failed to read login shell via getpwuid() for current user, falling back to /bin/sh', file=sys.stderr)
|
print('Failed to read login shell via getpwuid() for current user, falling back to /bin/sh', file=sys.stderr)
|
||||||
shell_path = '/bin/sh'
|
shell_path = '/bin/sh'
|
||||||
ssh_control_master_template = 'ssh-kitten-{kitty_pid}-master-{ssh_placeholder}'
|
# Keep this short as it is limited to 103 bytes on macOS
|
||||||
|
# https://github.com/ansible/ansible/issues/11536#issuecomment-153030743
|
||||||
|
ssh_control_master_template = 'kssh-{kitty_pid}-{ssh_placeholder}'
|
||||||
|
|
||||||
|
|
||||||
def glfw_path(module: str) -> str:
|
def glfw_path(module: str) -> str:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user