mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for file dialogs not working on windows with non-ascii environment variables
This commit is contained in:
parent
0766cdd135
commit
f658563023
@ -111,8 +111,6 @@ def run_file_dialog(
|
|||||||
file_types=()
|
file_types=()
|
||||||
):
|
):
|
||||||
from calibre.gui2 import sanitize_env_vars
|
from calibre.gui2 import sanitize_env_vars
|
||||||
with sanitize_env_vars():
|
|
||||||
env = os.environ.copy()
|
|
||||||
secret = os.urandom(32).replace(b'\0', b' ')
|
secret = os.urandom(32).replace(b'\0', b' ')
|
||||||
pipename = '\\\\.\\pipe\\%s' % uuid4()
|
pipename = '\\\\.\\pipe\\%s' % uuid4()
|
||||||
data = [serialize_string('PIPENAME', pipename), serialize_secret(secret)]
|
data = [serialize_string('PIPENAME', pipename), serialize_secret(secret)]
|
||||||
@ -157,8 +155,9 @@ def run_file_dialog(
|
|||||||
data.append(serialize_file_types(file_types))
|
data.append(serialize_file_types(file_types))
|
||||||
loop = Loop()
|
loop = Loop()
|
||||||
server = PipeServer(pipename)
|
server = PipeServer(pipename)
|
||||||
h = Helper(subprocess.Popen(
|
with sanitize_env_vars():
|
||||||
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, env=env),
|
h = Helper(subprocess.Popen(
|
||||||
|
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
|
||||||
data, loop.dialog_closed.emit)
|
data, loop.dialog_closed.emit)
|
||||||
h.start()
|
h.start()
|
||||||
loop.exec_(QEventLoop.ExcludeUserInputEvents)
|
loop.exec_(QEventLoop.ExcludeUserInputEvents)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user