mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
py3: Use native string for singleinstance address format
This commit is contained in:
parent
5623d8c7f4
commit
d2bcc94034
@ -13,7 +13,7 @@ import time
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from calibre.constants import (
|
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
|
from calibre.utils.monotonic import monotonic
|
||||||
|
|
||||||
@ -148,8 +148,10 @@ elif islinux:
|
|||||||
name = '%s-singleinstance-%s-%s' % (
|
name = '%s-singleinstance-%s-%s' % (
|
||||||
__appname__, (os.geteuid() if per_user else ''), name
|
__appname__, (os.geteuid() if per_user else ''), name
|
||||||
)
|
)
|
||||||
name = name.encode('utf-8')
|
name = name
|
||||||
address = b'\0' + name.replace(b' ', b'_')
|
address = '\0' + name.replace(' ', '_')
|
||||||
|
if not ispy3:
|
||||||
|
address = address.encode('utf-8')
|
||||||
sock = socket.socket(family=socket.AF_UNIX)
|
sock = socket.socket(family=socket.AF_UNIX)
|
||||||
try:
|
try:
|
||||||
eintr_retry_call(sock.bind, address)
|
eintr_retry_call(sock.bind, address)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user