mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-21 10:16:02 +01:00
py3: Use native string for singleinstance address format
This commit is contained in:
parent
5623d8c7f4
commit
d2bcc94034
1 changed files with 5 additions and 3 deletions
|
|
@ -13,7 +13,7 @@
|
|||
from functools import partial
|
||||
|
||||
from calibre.constants import (
|
||||
__appname__, fcntl, filesystem_encoding, islinux, isosx, iswindows, plugins
|
||||
__appname__, fcntl, filesystem_encoding, islinux, isosx, iswindows, plugins, ispy3
|
||||
)
|
||||
from calibre.utils.monotonic import monotonic
|
||||
|
||||
|
|
@ -148,8 +148,10 @@ def create_single_instance_mutex(name, per_user=True):
|
|||
name = '%s-singleinstance-%s-%s' % (
|
||||
__appname__, (os.geteuid() if per_user else ''), name
|
||||
)
|
||||
name = name.encode('utf-8')
|
||||
address = b'\0' + name.replace(b' ', b'_')
|
||||
name = name
|
||||
address = '\0' + name.replace(' ', '_')
|
||||
if not ispy3:
|
||||
address = address.encode('utf-8')
|
||||
sock = socket.socket(family=socket.AF_UNIX)
|
||||
try:
|
||||
eintr_retry_call(sock.bind, address)
|
||||
|
|
|
|||
Loading…
Reference in a new issue