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=()
|
||||
):
|
||||
from calibre.gui2 import sanitize_env_vars
|
||||
with sanitize_env_vars():
|
||||
env = os.environ.copy()
|
||||
secret = os.urandom(32).replace(b'\0', b' ')
|
||||
pipename = '\\\\.\\pipe\\%s' % uuid4()
|
||||
data = [serialize_string('PIPENAME', pipename), serialize_secret(secret)]
|
||||
@ -157,8 +155,9 @@ def run_file_dialog(
|
||||
data.append(serialize_file_types(file_types))
|
||||
loop = Loop()
|
||||
server = PipeServer(pipename)
|
||||
with sanitize_env_vars():
|
||||
h = Helper(subprocess.Popen(
|
||||
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, env=env),
|
||||
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
|
||||
data, loop.dialog_closed.emit)
|
||||
h.start()
|
||||
loop.exec_(QEventLoop.ExcludeUserInputEvents)
|
||||
|
Loading…
x
Reference in New Issue
Block a user