Skip to content

Commit

Permalink
Fix for file dialogs not working on windows with non-ascii environmen…
Browse files Browse the repository at this point in the history
…t variables
  • Loading branch information
kovidgoyal committed Jun 18, 2016
1 parent 0766cdd commit f658563
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/calibre/gui2/win_file_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -157,8 +155,9 @@ def run_file_dialog(
data.append(serialize_file_types(file_types))
loop = Loop()
server = PipeServer(pipename)
h = Helper(subprocess.Popen(
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, env=env),
with sanitize_env_vars():
h = Helper(subprocess.Popen(
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
data, loop.dialog_closed.emit)
h.start()
loop.exec_(QEventLoop.ExcludeUserInputEvents)
Expand Down

0 comments on commit f658563

Please sign in to comment.