Use a stable path for listener socket on macOS

This commit is contained in:
Kovid Goyal 2025-03-28 11:44:56 +05:30
parent e316b304d6
commit c17f560dad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -44,11 +44,7 @@ def socket_address(which):
sock_name = '{}-calibre-{}.socket'.format(ascii_filename(user).replace(' ', '_'), which)
ans = '\0' + sock_name
else:
# tempdir already contains calibre in its path
sock_name = f'{os.getuid()}-{which}.sock'
from tempfile import gettempdir
tmp = force_unicode(gettempdir(), filesystem_encoding)
ans = os.path.join(tmp, sock_name)
ans = f'/tmp/calibre-{os.getuid()}-{which}.sock'
return ans