File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2925,13 +2925,17 @@ def _initialize():
29252925
29262926 """
29272927 old_stderr = None
2928- try :
2929- old_stderr = _os .dup (2 )
2930- devnull = _os .open (_os .devnull , _os .O_WRONLY )
2931- _os .dup2 (devnull , 2 )
2932- _os .close (devnull )
2933- except OSError :
2934- pass
2928+ # Duping std file descriptors in a frozen context on windows will corrupt
2929+ # the fd and cause issues with e.g. subprocess.check_output. This happens
2930+ # for example in a compiled pyinstaller exe. See #461 for details.
2931+ if _sys .platform != 'win32' or not getattr (_sys , 'frozen' , False ):
2932+ try :
2933+ old_stderr = _os .dup (2 )
2934+ devnull = _os .open (_os .devnull , _os .O_WRONLY )
2935+ _os .dup2 (devnull , 2 )
2936+ _os .close (devnull )
2937+ except OSError :
2938+ pass
29352939 try :
29362940 _check (_lib .Pa_Initialize (), 'Error initializing PortAudio' )
29372941 global _initialized
You can’t perform that action at this time.
0 commit comments